consistent formatting
This commit is contained in:
parent
57dfd91378
commit
c720cf22aa
@ -23,9 +23,11 @@ import android.content.Context;
|
||||
|
||||
public class AndroidAssetAdapter extends AssetAdapter {
|
||||
Context mContext;
|
||||
|
||||
public AndroidAssetAdapter(Context ctx) {
|
||||
mContext = ctx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream openFileAsStream(String fileName) {
|
||||
try {
|
||||
|
@ -16,8 +16,7 @@ package org.oscim.android;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
public class AndroidLog implements org.oscim.backend.Log.Logger{
|
||||
public class AndroidLog implements org.oscim.backend.Log.Logger {
|
||||
|
||||
@Override
|
||||
public void d(String tag, String msg) {
|
||||
|
@ -24,7 +24,7 @@ import android.opengl.GLSurfaceView;
|
||||
|
||||
public class GLView extends GLSurfaceView {
|
||||
|
||||
class GLRenderer extends org.oscim.renderer.MapRenderer implements GLSurfaceView.Renderer{
|
||||
class GLRenderer extends org.oscim.renderer.MapRenderer implements GLSurfaceView.Renderer {
|
||||
|
||||
public GLRenderer(Map map) {
|
||||
super(map);
|
||||
@ -47,7 +47,6 @@ public class GLView extends GLSurfaceView {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public GLView(Context context, Map map) {
|
||||
super(context);
|
||||
setEGLConfigChooser(new GlConfigChooser());
|
||||
|
@ -41,6 +41,7 @@ public abstract class MapActivity extends Activity {
|
||||
private static final String KEY_MAP_SCALE = "map_scale";
|
||||
|
||||
private static final String PREFERENCES_FILE = "MapActivity";
|
||||
|
||||
//private static final String KEY_THEME = "Theme";
|
||||
|
||||
private static boolean containsViewport(SharedPreferences sharedPreferences) {
|
||||
@ -73,7 +74,7 @@ public abstract class MapActivity extends Activity {
|
||||
|
||||
editor.putInt(KEY_LATITUDE, geoPoint.latitudeE6);
|
||||
editor.putInt(KEY_LONGITUDE, geoPoint.longitudeE6);
|
||||
editor.putFloat(KEY_MAP_SCALE, (float)mapPosition.scale);
|
||||
editor.putFloat(KEY_MAP_SCALE, (float) mapPosition.scale);
|
||||
|
||||
//editor.putString(KEY_THEME, mMap.getRenderTheme());
|
||||
|
||||
@ -108,7 +109,6 @@ public abstract class MapActivity extends Activity {
|
||||
int longitudeE6 = sharedPreferences.getInt(KEY_LONGITUDE, 0);
|
||||
float scale = sharedPreferences.getFloat(KEY_MAP_SCALE, 1);
|
||||
|
||||
|
||||
MapPosition mapPosition = new MapPosition();
|
||||
mapPosition.setPosition(latitudeE6 / 1E6, longitudeE6 / 1E6);
|
||||
mapPosition.setScale(scale);
|
||||
@ -119,18 +119,18 @@ public abstract class MapActivity extends Activity {
|
||||
//String theme = sharedPreferences.getString(KEY_THEME,
|
||||
// InternalRenderTheme.DEFAULT.name());
|
||||
|
||||
// if (theme.startsWith("/")) {
|
||||
// try {
|
||||
// map.setRenderTheme(theme);
|
||||
// } catch (FileNotFoundException e) {
|
||||
// map.setRenderTheme(InternalRenderTheme.DEFAULT);
|
||||
// }
|
||||
// } else {
|
||||
// try {
|
||||
// map.setRenderTheme(InternalRenderTheme.valueOf(theme));
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// map.setRenderTheme(InternalRenderTheme.DEFAULT);
|
||||
// }
|
||||
// }
|
||||
// if (theme.startsWith("/")) {
|
||||
// try {
|
||||
// map.setRenderTheme(theme);
|
||||
// } catch (FileNotFoundException e) {
|
||||
// map.setRenderTheme(InternalRenderTheme.DEFAULT);
|
||||
// }
|
||||
// } else {
|
||||
// try {
|
||||
// map.setRenderTheme(InternalRenderTheme.valueOf(theme));
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// map.setRenderTheme(InternalRenderTheme.DEFAULT);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
package org.oscim.android;
|
||||
|
||||
///*
|
||||
// * Copyright 2010, 2011, 2012 mapsforge.org
|
||||
// * Copyright 2013 Hannes Janetzek
|
||||
|
@ -51,7 +51,6 @@ public class MapView extends RelativeLayout {
|
||||
private int mWidth;
|
||||
private int mHeight;
|
||||
|
||||
|
||||
private final Map mMap;
|
||||
|
||||
final GLView mGLView;
|
||||
@ -100,7 +99,7 @@ public class MapView extends RelativeLayout {
|
||||
this.setWillNotDraw(true);
|
||||
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
CanvasAdapter.dpi = (int)Math.max(metrics.xdpi, metrics.ydpi);
|
||||
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
|
||||
|
||||
// TODO make this dpi dependent
|
||||
Tile.SIZE = 400;
|
||||
@ -109,7 +108,7 @@ public class MapView extends RelativeLayout {
|
||||
|
||||
final MapView m = this;
|
||||
|
||||
mMap = new Map(){
|
||||
mMap = new Map() {
|
||||
|
||||
boolean mWaitRedraw;
|
||||
|
||||
@ -190,7 +189,7 @@ public class MapView extends RelativeLayout {
|
||||
mMap.updateMap(false);
|
||||
}
|
||||
|
||||
View getView(){
|
||||
View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -203,7 +202,6 @@ public class MapView extends RelativeLayout {
|
||||
//mMap.destroy();
|
||||
}
|
||||
|
||||
|
||||
void onPause() {
|
||||
mPausing = true;
|
||||
|
||||
@ -250,7 +248,6 @@ public class MapView extends RelativeLayout {
|
||||
mMap.getViewport().setViewport(width, height);
|
||||
}
|
||||
|
||||
|
||||
public void enableRotation(boolean enable) {
|
||||
mRotationEnabled = enable;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
package org.oscim.android;
|
||||
|
||||
///*
|
||||
// * Copyright 2010, 2011, 2012 mapsforge.org
|
||||
// *
|
||||
|
@ -31,11 +31,12 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap {
|
||||
/**
|
||||
* @param format ignored always ARGB8888
|
||||
*/
|
||||
public AndroidBitmap(int width, int height, int format){
|
||||
public AndroidBitmap(int width, int height, int format) {
|
||||
mBitmap = android.graphics.Bitmap
|
||||
.createBitmap(width, height, android.graphics.Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
AndroidBitmap(android.graphics.Bitmap bitmap){
|
||||
|
||||
AndroidBitmap(android.graphics.Bitmap bitmap) {
|
||||
mBitmap = bitmap;
|
||||
}
|
||||
|
||||
|
@ -10,19 +10,21 @@ public class AndroidCanvas implements Canvas {
|
||||
public AndroidCanvas() {
|
||||
this.canvas = new android.graphics.Canvas();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBitmap(Bitmap bitmap) {
|
||||
this.canvas.setBitmap(((AndroidBitmap)bitmap).mBitmap);
|
||||
this.canvas.setBitmap(((AndroidBitmap) bitmap).mBitmap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawText(String string, float x, float y, Paint stroke) {
|
||||
this.canvas.drawText(string, x, y, ((AndroidPaint)stroke).mPaint);
|
||||
this.canvas.drawText(string, x, y, ((AndroidPaint) stroke).mPaint);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBitmap(Bitmap bitmap, float x, float y) {
|
||||
this.canvas.drawBitmap(((AndroidBitmap)bitmap).mBitmap, x, y, null);
|
||||
this.canvas.drawBitmap(((AndroidBitmap) bitmap).mBitmap, x, y, null);
|
||||
|
||||
}
|
||||
|
||||
|
@ -100,8 +100,8 @@ public final class AndroidGraphics extends CanvasAdapter {
|
||||
return new AndroidBitmap(((BitmapDrawable) drawable).getBitmap());
|
||||
}
|
||||
|
||||
android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap(
|
||||
drawable.getIntrinsicWidth(),
|
||||
android.graphics.Bitmap bitmap = android.graphics.Bitmap
|
||||
.createBitmap(drawable.getIntrinsicWidth(),
|
||||
drawable.getIntrinsicHeight(),
|
||||
Config.ARGB_8888);
|
||||
|
||||
|
@ -92,8 +92,10 @@ class AndroidPaint implements Paint {
|
||||
}
|
||||
|
||||
android.graphics.Bitmap androidBitmap = android.graphics.Bitmap
|
||||
.createBitmap(bitmap.getPixels(), bitmap.getWidth(),
|
||||
bitmap.getHeight(), Config.ARGB_8888);
|
||||
.createBitmap(bitmap.getPixels(),
|
||||
bitmap.getWidth(),
|
||||
bitmap.getHeight(),
|
||||
Config.ARGB_8888);
|
||||
Shader shader = new BitmapShader(androidBitmap, TileMode.REPEAT,
|
||||
TileMode.REPEAT);
|
||||
mPaint.setShader(shader);
|
||||
|
@ -24,7 +24,6 @@ import android.opengl.GLES20;
|
||||
|
||||
public class AndroidGL implements GL20 {
|
||||
|
||||
|
||||
@Override
|
||||
public void glAttachShader(int program, int shader) {
|
||||
GLES20.glAttachShader(program, shader);
|
||||
|
@ -13,6 +13,7 @@
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.oscim.android.input;
|
||||
|
||||
import org.oscim.event.MotionEvent;
|
||||
|
||||
public class AndroidMotionEvent extends MotionEvent {
|
||||
@ -28,7 +29,7 @@ public class AndroidMotionEvent extends MotionEvent {
|
||||
|
||||
android.view.MotionEvent mEvent;
|
||||
|
||||
public void wrap(android.view.MotionEvent e){
|
||||
public void wrap(android.view.MotionEvent e) {
|
||||
mEvent = e;
|
||||
}
|
||||
|
||||
@ -36,6 +37,7 @@ public class AndroidMotionEvent extends MotionEvent {
|
||||
public int getAction() {
|
||||
return mEvent.getAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getX() {
|
||||
return mEvent.getX();
|
||||
@ -66,5 +68,4 @@ public class AndroidMotionEvent extends MotionEvent {
|
||||
return mEvent.getEventTime();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -15,11 +15,12 @@
|
||||
package org.oscim.utils.osm;
|
||||
|
||||
public class OSMMember {
|
||||
public enum MemberType{
|
||||
public enum MemberType {
|
||||
NODE,
|
||||
WAY,
|
||||
RELATIOM
|
||||
}
|
||||
|
||||
static final boolean useDebugLabels = true;
|
||||
|
||||
public final String role;
|
||||
|
@ -16,9 +16,6 @@ import org.oscim.utils.osm.OSMNode;
|
||||
import org.oscim.utils.osm.OSMRelation;
|
||||
import org.oscim.utils.osm.OSMWay;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class that reads and parses binary files and sends the contained entities to
|
||||
* the sink.
|
||||
@ -205,32 +202,31 @@ public class OsmPbfParser extends BinaryParser {
|
||||
for (int j = 0; j < tagCnt; j++)
|
||||
tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j))));
|
||||
|
||||
|
||||
long id = i.getId();
|
||||
|
||||
long lastMid = 0;
|
||||
List<OSMMember> nodes = new ArrayList<OSMMember>();
|
||||
int memberCnt = i.getMemidsCount();
|
||||
|
||||
// for (int j = 0; j < memberCnt; j++) {
|
||||
// long mid = lastMid + i.getMemids(j);
|
||||
// lastMid = mid;
|
||||
// String role = getStringById(i.getRolesSid(j));
|
||||
//
|
||||
// Osmformat.Relation.MemberType t = i.getTypes(j);
|
||||
//
|
||||
// if (t == Osmformat.Relation.MemberType.NODE) {
|
||||
// etype = EntityType.Node;
|
||||
// } else if (t == Osmformat.Relation.MemberType.WAY) {
|
||||
// etype = EntityType.Way;
|
||||
// } else if (t == Osmformat.Relation.MemberType.RELATION) {
|
||||
// etype = EntityType.Relation;
|
||||
// } else {
|
||||
// assert false; // TODO; Illegal file?
|
||||
// }
|
||||
//
|
||||
// nodes.add(new OSMMember(mid, etype, role));
|
||||
// }
|
||||
// for (int j = 0; j < memberCnt; j++) {
|
||||
// long mid = lastMid + i.getMemids(j);
|
||||
// lastMid = mid;
|
||||
// String role = getStringById(i.getRolesSid(j));
|
||||
//
|
||||
// Osmformat.Relation.MemberType t = i.getTypes(j);
|
||||
//
|
||||
// if (t == Osmformat.Relation.MemberType.NODE) {
|
||||
// etype = EntityType.Node;
|
||||
// } else if (t == Osmformat.Relation.MemberType.WAY) {
|
||||
// etype = EntityType.Way;
|
||||
// } else if (t == Osmformat.Relation.MemberType.RELATION) {
|
||||
// etype = EntityType.Relation;
|
||||
// } else {
|
||||
// assert false; // TODO; Illegal file?
|
||||
// }
|
||||
//
|
||||
// nodes.add(new OSMMember(mid, etype, role));
|
||||
// }
|
||||
|
||||
// long id, int version, TimestampContainer timestampContainer,
|
||||
// OsmUser user,
|
||||
@ -246,7 +242,7 @@ public class OsmPbfParser extends BinaryParser {
|
||||
// tmp = new Relation(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
|
||||
// NOCHANGESET, tags), nodes);
|
||||
// }
|
||||
// sink.process(new RelationContainer(tmp));
|
||||
// sink.process(new RelationContainer(tmp));
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,40 +277,39 @@ public class OsmPbfParser extends BinaryParser {
|
||||
|
||||
public OSMData getData() {
|
||||
|
||||
// for (Entry<OSMRelation, List<TmpRelation>> entry : relationMembersForRelation
|
||||
// .entrySet()) {
|
||||
//
|
||||
// OSMRelation relation = entry.getKey();
|
||||
//
|
||||
// for (TmpRelation member : entry.getValue()) {
|
||||
//
|
||||
// OSMElement memberObject = null;
|
||||
//
|
||||
// if ("node".equals(member)) {
|
||||
// memberObject = nodesById.get(member.id);
|
||||
// } else if ("way".equals(member)) {
|
||||
// memberObject = waysById.get(member.id);
|
||||
// } else if ("relation".equals(member)) {
|
||||
// memberObject = relationsById.get(member.id);
|
||||
// } else {
|
||||
// // log("missing relation " + member.id);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (memberObject != null) {
|
||||
// OSMMember ownMember = new OSMMember(member.role,
|
||||
// memberObject);
|
||||
//
|
||||
// relation.relationMembers.add(ownMember);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (Entry<OSMRelation, List<TmpRelation>> entry : relationMembersForRelation
|
||||
// .entrySet()) {
|
||||
//
|
||||
// OSMRelation relation = entry.getKey();
|
||||
//
|
||||
// for (TmpRelation member : entry.getValue()) {
|
||||
//
|
||||
// OSMElement memberObject = null;
|
||||
//
|
||||
// if ("node".equals(member)) {
|
||||
// memberObject = nodesById.get(member.id);
|
||||
// } else if ("way".equals(member)) {
|
||||
// memberObject = waysById.get(member.id);
|
||||
// } else if ("relation".equals(member)) {
|
||||
// memberObject = relationsById.get(member.id);
|
||||
// } else {
|
||||
// // log("missing relation " + member.id);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (memberObject != null) {
|
||||
// OSMMember ownMember = new OSMMember(member.role,
|
||||
// memberObject);
|
||||
//
|
||||
// relation.relationMembers.add(ownMember);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// give up references to original collections
|
||||
|
||||
ArrayList<OSMWay> ways = new ArrayList<OSMWay> (mWayMap.values());
|
||||
ArrayList<OSMNode> nodes= new ArrayList<OSMNode> (mNodeMap.values());
|
||||
ArrayList<OSMWay> ways = new ArrayList<OSMWay>(mWayMap.values());
|
||||
ArrayList<OSMNode> nodes = new ArrayList<OSMNode>(mNodeMap.values());
|
||||
|
||||
Log.d("..", "nodes: " + nodes.size() + " ways: " + ways.size());
|
||||
|
||||
|
@ -22,7 +22,7 @@ import org.oscim.utils.osm.OSMData;
|
||||
|
||||
public class OsmPbfReader {
|
||||
|
||||
public static OSMData process(InputStream is){
|
||||
public static OSMData process(InputStream is) {
|
||||
OsmPbfParser parser = new OsmPbfParser();
|
||||
|
||||
try {
|
||||
|
@ -322,18 +322,17 @@ public class OverpassAPIReader {
|
||||
|
||||
TagSet tags = null;
|
||||
|
||||
|
||||
while (jp.nextToken() != JsonToken.END_OBJECT) {
|
||||
String key = jp.getCurrentName();
|
||||
jp.nextToken();
|
||||
String val = jp.getText();
|
||||
if (tags== null)
|
||||
tags= new TagSet(4);
|
||||
if (tags == null)
|
||||
tags = new TagSet(4);
|
||||
|
||||
tags.add(new Tag(key, val, false));
|
||||
|
||||
}
|
||||
if (tags== null)
|
||||
if (tags == null)
|
||||
return TagSet.EMPTY_TAG_SET;
|
||||
|
||||
return tags;
|
||||
@ -343,7 +342,6 @@ public class OverpassAPIReader {
|
||||
System.out.println(msg);
|
||||
}
|
||||
|
||||
|
||||
public OSMData getData() {
|
||||
|
||||
String encoded;
|
||||
|
@ -193,7 +193,6 @@ public class WKBReader {
|
||||
if (i > 0)
|
||||
mGeom.startHole();
|
||||
|
||||
|
||||
int points = data.getInt();
|
||||
|
||||
for (int j = 0; j < points; j++) {
|
||||
|
@ -16,8 +16,7 @@ package org.oscim.android;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
public class AndroidLog implements org.oscim.backend.Log.Logger{
|
||||
public class AndroidLog implements org.oscim.backend.Log.Logger {
|
||||
|
||||
@Override
|
||||
public void d(String tag, String msg) {
|
||||
|
@ -31,11 +31,12 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap {
|
||||
/**
|
||||
* @param format ignored always ARGB8888
|
||||
*/
|
||||
public AndroidBitmap(int width, int height, int format){
|
||||
public AndroidBitmap(int width, int height, int format) {
|
||||
mBitmap = android.graphics.Bitmap
|
||||
.createBitmap(width, height, android.graphics.Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
AndroidBitmap(android.graphics.Bitmap bitmap){
|
||||
|
||||
AndroidBitmap(android.graphics.Bitmap bitmap) {
|
||||
mBitmap = bitmap;
|
||||
}
|
||||
|
||||
|
@ -10,19 +10,21 @@ public class AndroidCanvas implements Canvas {
|
||||
public AndroidCanvas() {
|
||||
this.canvas = new android.graphics.Canvas();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBitmap(Bitmap bitmap) {
|
||||
this.canvas.setBitmap(((AndroidBitmap)bitmap).mBitmap);
|
||||
this.canvas.setBitmap(((AndroidBitmap) bitmap).mBitmap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawText(String string, float x, float y, Paint stroke) {
|
||||
this.canvas.drawText(string, x, y, ((AndroidPaint)stroke).mPaint);
|
||||
this.canvas.drawText(string, x, y, ((AndroidPaint) stroke).mPaint);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBitmap(Bitmap bitmap, float x, float y) {
|
||||
this.canvas.drawBitmap(((AndroidBitmap)bitmap).mBitmap, x, y, null);
|
||||
this.canvas.drawBitmap(((AndroidBitmap) bitmap).mBitmap, x, y, null);
|
||||
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ public final class AndroidGraphics extends CanvasAdapter {
|
||||
return new AndroidBitmap(((BitmapDrawable) drawable).getBitmap());
|
||||
}
|
||||
|
||||
android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap(
|
||||
drawable.getIntrinsicWidth(),
|
||||
android.graphics.Bitmap bitmap = android.graphics.Bitmap
|
||||
.createBitmap(drawable.getIntrinsicWidth(),
|
||||
drawable.getIntrinsicHeight(),
|
||||
Config.ARGB_8888);
|
||||
|
||||
|
@ -62,8 +62,7 @@ class AndroidPaint implements Paint {
|
||||
final android.graphics.Paint mPaint;
|
||||
|
||||
AndroidPaint() {
|
||||
mPaint = new android.graphics.Paint(
|
||||
android.graphics.Paint.ANTI_ALIAS_FLAG);
|
||||
mPaint = new android.graphics.Paint(android.graphics.Paint.ANTI_ALIAS_FLAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,7 +39,7 @@ public class AwtCanvas implements Canvas {
|
||||
if (canvas != null)
|
||||
canvas.dispose();
|
||||
|
||||
AwtBitmap awtBitamp = (AwtBitmap)bitmap;
|
||||
AwtBitmap awtBitamp = (AwtBitmap) bitmap;
|
||||
|
||||
canvas = awtBitamp.bitmap.createGraphics();
|
||||
|
||||
@ -48,22 +48,22 @@ public class AwtCanvas implements Canvas {
|
||||
|
||||
canvas.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
|
||||
|
||||
canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
|
||||
canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
//canvas.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
|
||||
canvas.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
canvas.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawText(String text, float x, float y, Paint paint) {
|
||||
|
||||
// if (paint.isTransparent()) {
|
||||
// return;
|
||||
// }
|
||||
// if (paint.isTransparent()) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
AwtPaint awtPaint = (AwtPaint)paint;
|
||||
AwtPaint awtPaint = (AwtPaint) paint;
|
||||
|
||||
//AwtPaint awtPaint = AwtGraphicFactory.getAwtPaint(paint);
|
||||
|
||||
@ -73,7 +73,9 @@ public class AwtCanvas implements Canvas {
|
||||
canvas.drawString(text, x + 2, y);
|
||||
} else {
|
||||
setColorAndStroke(awtPaint);
|
||||
TextLayout textLayout = new TextLayout(text, awtPaint.font, canvas.getFontRenderContext());
|
||||
TextLayout textLayout = new TextLayout(text,
|
||||
awtPaint.font,
|
||||
canvas.getFontRenderContext());
|
||||
AffineTransform affineTransform = new AffineTransform();
|
||||
affineTransform.translate(x + 2, y);
|
||||
canvas.draw(textLayout.getOutline(affineTransform));
|
||||
@ -87,15 +89,15 @@ public class AwtCanvas implements Canvas {
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void drawText(String string, float x, float y, Paint stroke) {
|
||||
// AwtPaint p = (AwtPaint)stroke;
|
||||
//
|
||||
// canvas.setFont(p.font);
|
||||
// canvas.setColor(p.color);
|
||||
//
|
||||
// canvas.drawString(string, (int)x, (int)y);
|
||||
// }
|
||||
// @Override
|
||||
// public void drawText(String string, float x, float y, Paint stroke) {
|
||||
// AwtPaint p = (AwtPaint)stroke;
|
||||
//
|
||||
// canvas.setFont(p.font);
|
||||
// canvas.setColor(p.color);
|
||||
//
|
||||
// canvas.drawString(string, (int)x, (int)y);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void drawBitmap(Bitmap bitmap, float x, float y) {
|
||||
|
@ -54,10 +54,12 @@ public class AwtGraphics extends CanvasAdapter {
|
||||
static {
|
||||
image = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
|
||||
canvas = image.createGraphics();
|
||||
canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
|
||||
canvas.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
//canvas.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
|
||||
//canvas.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
}
|
||||
|
||||
static synchronized FontMetrics getFontMetrics(Font font) {
|
||||
canvas.setFont(font);
|
||||
// get character measurements
|
||||
|
@ -60,6 +60,7 @@ public class AwtPaint implements Paint {
|
||||
|
||||
private int cap;
|
||||
private float strokeWidth;
|
||||
|
||||
//private Align mAlign;
|
||||
|
||||
@Override
|
||||
|
890
vtm-gdx-desktop/src/org/oscim/gdx/GdxGL20.java
Normal file
890
vtm-gdx-desktop/src/org/oscim/gdx/GdxGL20.java
Normal file
@ -0,0 +1,890 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011 See AUTHORS file.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
package org.oscim.gdx;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
import com.badlogic.gdx.graphics.GL10;
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
|
||||
/**
|
||||
* An implementation of the {@link GL20} interface based on LWJGL. Note that
|
||||
* LWJGL shaders and OpenGL ES shaders will not be 100%
|
||||
* compatible. Some glGetXXX methods are not implemented.
|
||||
*
|
||||
* @author mzechner
|
||||
*/
|
||||
public final class GdxGL20 implements org.oscim.backend.GL20 {
|
||||
public void glActiveTexture(int texture) {
|
||||
GL13.glActiveTexture(texture);
|
||||
}
|
||||
|
||||
public void glAttachShader(int program, int shader) {
|
||||
GL20.glAttachShader(program, shader);
|
||||
}
|
||||
|
||||
public void glBindAttribLocation(int program, int index, String name) {
|
||||
GL20.glBindAttribLocation(program, index, name);
|
||||
}
|
||||
|
||||
public void glBindBuffer(int target, int buffer) {
|
||||
GL15.glBindBuffer(target, buffer);
|
||||
}
|
||||
|
||||
public void glBindFramebuffer(int target, int framebuffer) {
|
||||
EXTFramebufferObject.glBindFramebufferEXT(target, framebuffer);
|
||||
}
|
||||
|
||||
public void glBindRenderbuffer(int target, int renderbuffer) {
|
||||
EXTFramebufferObject.glBindRenderbufferEXT(target, renderbuffer);
|
||||
}
|
||||
|
||||
public void glBindTexture(int target, int texture) {
|
||||
GL11.glBindTexture(target, texture);
|
||||
}
|
||||
|
||||
public void glBlendColor(float red, float green, float blue, float alpha) {
|
||||
GL14.glBlendColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void glBlendEquation(int mode) {
|
||||
GL14.glBlendEquation(mode);
|
||||
}
|
||||
|
||||
public void glBlendEquationSeparate(int modeRGB, int modeAlpha) {
|
||||
GL20.glBlendEquationSeparate(modeRGB, modeAlpha);
|
||||
}
|
||||
|
||||
public void glBlendFunc(int sfactor, int dfactor) {
|
||||
GL11.glBlendFunc(sfactor, dfactor);
|
||||
}
|
||||
|
||||
public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
|
||||
GL14.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
public void glBufferData(int target, int size, Buffer data, int usage) {
|
||||
if (data == null)
|
||||
throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL");
|
||||
else if (data instanceof ByteBuffer)
|
||||
GL15.glBufferData(target, (ByteBuffer) data, usage);
|
||||
else if (data instanceof IntBuffer)
|
||||
GL15.glBufferData(target, (IntBuffer) data, usage);
|
||||
else if (data instanceof FloatBuffer)
|
||||
GL15.glBufferData(target, (FloatBuffer) data, usage);
|
||||
else if (data instanceof DoubleBuffer)
|
||||
GL15.glBufferData(target, (DoubleBuffer) data, usage);
|
||||
else if (data instanceof ShortBuffer) //
|
||||
GL15.glBufferData(target, (ShortBuffer) data, usage);
|
||||
}
|
||||
|
||||
public void glBufferSubData(int target, int offset, int size, Buffer data) {
|
||||
if (data == null)
|
||||
throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL");
|
||||
else if (data instanceof ByteBuffer)
|
||||
GL15.glBufferSubData(target, offset, (ByteBuffer) data);
|
||||
else if (data instanceof IntBuffer)
|
||||
GL15.glBufferSubData(target, offset, (IntBuffer) data);
|
||||
else if (data instanceof FloatBuffer)
|
||||
GL15.glBufferSubData(target, offset, (FloatBuffer) data);
|
||||
else if (data instanceof DoubleBuffer)
|
||||
GL15.glBufferSubData(target, offset, (DoubleBuffer) data);
|
||||
else if (data instanceof ShortBuffer) //
|
||||
GL15.glBufferSubData(target, offset, (ShortBuffer) data);
|
||||
}
|
||||
|
||||
public int glCheckFramebufferStatus(int target) {
|
||||
return EXTFramebufferObject.glCheckFramebufferStatusEXT(target);
|
||||
}
|
||||
|
||||
public void glClear(int mask) {
|
||||
GL11.glClear(mask);
|
||||
}
|
||||
|
||||
public void glClearColor(float red, float green, float blue, float alpha) {
|
||||
GL11.glClearColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void glClearDepthf(float depth) {
|
||||
GL11.glClearDepth(depth);
|
||||
}
|
||||
|
||||
public void glClearStencil(int s) {
|
||||
GL11.glClearStencil(s);
|
||||
}
|
||||
|
||||
public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
GL11.glColorMask(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void glCompileShader(int shader) {
|
||||
GL20.glCompileShader(shader);
|
||||
}
|
||||
|
||||
public void glCompressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
int height, int border,
|
||||
int imageSize, Buffer data) {
|
||||
if (data instanceof ByteBuffer) {
|
||||
GL13.glCompressedTexImage2D(target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
(ByteBuffer) data);
|
||||
} else {
|
||||
throw new GdxRuntimeException("Can't use " + data.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer instead.");
|
||||
}
|
||||
}
|
||||
|
||||
public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format,
|
||||
int imageSize, Buffer data) {
|
||||
throw new GdxRuntimeException("not implemented");
|
||||
}
|
||||
|
||||
public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y,
|
||||
int width, int height, int border) {
|
||||
GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
|
||||
}
|
||||
|
||||
public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
int width, int height) {
|
||||
GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
public int glCreateProgram() {
|
||||
return GL20.glCreateProgram();
|
||||
}
|
||||
|
||||
public int glCreateShader(int type) {
|
||||
return GL20.glCreateShader(type);
|
||||
}
|
||||
|
||||
public void glCullFace(int mode) {
|
||||
GL11.glCullFace(mode);
|
||||
}
|
||||
|
||||
public void glDeleteBuffers(int n, IntBuffer buffers) {
|
||||
GL15.glDeleteBuffers(buffers);
|
||||
}
|
||||
|
||||
public void glDeleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffers);
|
||||
}
|
||||
|
||||
public void glDeleteProgram(int program) {
|
||||
GL20.glDeleteProgram(program);
|
||||
}
|
||||
|
||||
public void glDeleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
EXTFramebufferObject.glDeleteRenderbuffersEXT(renderbuffers);
|
||||
}
|
||||
|
||||
public void glDeleteShader(int shader) {
|
||||
GL20.glDeleteShader(shader);
|
||||
}
|
||||
|
||||
public void glDeleteTextures(int n, IntBuffer textures) {
|
||||
GL11.glDeleteTextures(textures);
|
||||
}
|
||||
|
||||
public void glDepthFunc(int func) {
|
||||
GL11.glDepthFunc(func);
|
||||
}
|
||||
|
||||
public void glDepthMask(boolean flag) {
|
||||
GL11.glDepthMask(flag);
|
||||
}
|
||||
|
||||
public void glDepthRangef(float zNear, float zFar) {
|
||||
GL11.glDepthRange(zNear, zFar);
|
||||
}
|
||||
|
||||
public void glDetachShader(int program, int shader) {
|
||||
GL20.glDetachShader(program, shader);
|
||||
}
|
||||
|
||||
public void glDisable(int cap) {
|
||||
GL11.glDisable(cap);
|
||||
}
|
||||
|
||||
public void glDisableVertexAttribArray(int index) {
|
||||
GL20.glDisableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public void glDrawArrays(int mode, int first, int count) {
|
||||
GL11.glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
public void glDrawElements(int mode, int count, int type, Buffer indices) {
|
||||
if (indices instanceof ShortBuffer && type == GL10.GL_UNSIGNED_SHORT)
|
||||
GL11.glDrawElements(mode, (ShortBuffer) indices);
|
||||
else if (indices instanceof ByteBuffer && type == GL10.GL_UNSIGNED_SHORT)
|
||||
GL11.glDrawElements(mode, ((ByteBuffer) indices).asShortBuffer()); // FIXME yay...
|
||||
else if (indices instanceof ByteBuffer && type == GL10.GL_UNSIGNED_BYTE)
|
||||
GL11.glDrawElements(mode, (ByteBuffer) indices);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + indices.getClass().getName()
|
||||
+ " with this method. Use ShortBuffer or ByteBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glEnable(int cap) {
|
||||
GL11.glEnable(cap);
|
||||
}
|
||||
|
||||
public void glEnableVertexAttribArray(int index) {
|
||||
GL20.glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public void glFinish() {
|
||||
GL11.glFinish();
|
||||
}
|
||||
|
||||
public void glFlush() {
|
||||
GL11.glFlush();
|
||||
}
|
||||
|
||||
public void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget,
|
||||
int renderbuffer) {
|
||||
EXTFramebufferObject.glFramebufferRenderbufferEXT(target,
|
||||
attachment,
|
||||
renderbuffertarget,
|
||||
renderbuffer);
|
||||
}
|
||||
|
||||
public void glFramebufferTexture2D(int target, int attachment, int textarget, int texture,
|
||||
int level) {
|
||||
EXTFramebufferObject.glFramebufferTexture2DEXT(target,
|
||||
attachment,
|
||||
textarget,
|
||||
texture,
|
||||
level);
|
||||
}
|
||||
|
||||
public void glFrontFace(int mode) {
|
||||
GL11.glFrontFace(mode);
|
||||
}
|
||||
|
||||
public void glGenBuffers(int n, IntBuffer buffers) {
|
||||
GL15.glGenBuffers(buffers);
|
||||
}
|
||||
|
||||
public void glGenFramebuffers(int n, IntBuffer framebuffers) {
|
||||
EXTFramebufferObject.glGenFramebuffersEXT(framebuffers);
|
||||
}
|
||||
|
||||
public void glGenRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
EXTFramebufferObject.glGenRenderbuffersEXT(renderbuffers);
|
||||
}
|
||||
|
||||
public void glGenTextures(int n, IntBuffer textures) {
|
||||
GL11.glGenTextures(textures);
|
||||
}
|
||||
|
||||
public void glGenerateMipmap(int target) {
|
||||
EXTFramebufferObject.glGenerateMipmapEXT(target);
|
||||
}
|
||||
|
||||
public String glGetActiveAttrib(int program, int index, IntBuffer size, Buffer type) {
|
||||
// FIXME this is less than ideal of course...
|
||||
IntBuffer typeTmp = BufferUtils.createIntBuffer(2);
|
||||
String name = GL20.glGetActiveAttrib(program, index, 256, typeTmp);
|
||||
if (type instanceof IntBuffer)
|
||||
((IntBuffer) type).put(typeTmp.get(0));
|
||||
return name;
|
||||
}
|
||||
|
||||
public String glGetActiveUniform(int program, int index, IntBuffer size, Buffer type) {
|
||||
// FIXME this is less than ideal of course...
|
||||
IntBuffer typeTmp = BufferUtils.createIntBuffer(2);
|
||||
String name = GL20.glGetActiveUniform(program, index, 256, typeTmp);
|
||||
if (type instanceof IntBuffer)
|
||||
((IntBuffer) type).put(typeTmp.get(0));
|
||||
return name;
|
||||
}
|
||||
|
||||
public void glGetAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders) {
|
||||
GL20.glGetAttachedShaders(program, (IntBuffer) count, shaders);
|
||||
}
|
||||
|
||||
public int glGetAttribLocation(int program, String name) {
|
||||
return GL20.glGetAttribLocation(program, name);
|
||||
}
|
||||
|
||||
public void glGetBooleanv(int pname, Buffer params) {
|
||||
GL11.glGetBoolean(pname, (ByteBuffer) params);
|
||||
}
|
||||
|
||||
public void glGetBufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
GL15.glGetBufferParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public int glGetError() {
|
||||
return GL11.glGetError();
|
||||
}
|
||||
|
||||
public void glGetFloatv(int pname, FloatBuffer params) {
|
||||
GL11.glGetFloat(pname, params);
|
||||
}
|
||||
|
||||
public void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname,
|
||||
IntBuffer params) {
|
||||
EXTFramebufferObject.glGetFramebufferAttachmentParameterEXT(target,
|
||||
attachment,
|
||||
pname,
|
||||
params);
|
||||
}
|
||||
|
||||
public void glGetIntegerv(int pname, IntBuffer params) {
|
||||
GL11.glGetInteger(pname, params);
|
||||
}
|
||||
|
||||
public String glGetProgramInfoLog(int program) {
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
|
||||
buffer.order(ByteOrder.nativeOrder());
|
||||
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
|
||||
tmp.order(ByteOrder.nativeOrder());
|
||||
IntBuffer intBuffer = tmp.asIntBuffer();
|
||||
|
||||
GL20.glGetProgramInfoLog(program, intBuffer, buffer);
|
||||
int numBytes = intBuffer.get(0);
|
||||
byte[] bytes = new byte[numBytes];
|
||||
buffer.get(bytes);
|
||||
return new String(bytes);
|
||||
}
|
||||
|
||||
public void glGetProgramiv(int program, int pname, IntBuffer params) {
|
||||
GL20.glGetProgram(program, pname, params);
|
||||
}
|
||||
|
||||
public void glGetRenderbufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
EXTFramebufferObject.glGetRenderbufferParameterEXT(target, pname, params);
|
||||
}
|
||||
|
||||
public String glGetShaderInfoLog(int shader) {
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
|
||||
buffer.order(ByteOrder.nativeOrder());
|
||||
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
|
||||
tmp.order(ByteOrder.nativeOrder());
|
||||
IntBuffer intBuffer = tmp.asIntBuffer();
|
||||
|
||||
GL20.glGetShaderInfoLog(shader, intBuffer, buffer);
|
||||
int numBytes = intBuffer.get(0);
|
||||
byte[] bytes = new byte[numBytes];
|
||||
buffer.get(bytes);
|
||||
return new String(bytes);
|
||||
}
|
||||
|
||||
public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range,
|
||||
IntBuffer precision) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
public void glGetShaderSource(int shader, int bufsize, Buffer length, String source) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement.");
|
||||
}
|
||||
|
||||
public void glGetShaderiv(int shader, int pname, IntBuffer params) {
|
||||
GL20.glGetShader(shader, pname, params);
|
||||
}
|
||||
|
||||
public String glGetString(int name) {
|
||||
return GL11.glGetString(name);
|
||||
}
|
||||
|
||||
public void glGetTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
GL11.glGetTexParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public void glGetTexParameteriv(int target, int pname, IntBuffer params) {
|
||||
GL11.glGetTexParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public int glGetUniformLocation(int program, String name) {
|
||||
return GL20.glGetUniformLocation(program, name);
|
||||
}
|
||||
|
||||
public void glGetUniformfv(int program, int location, FloatBuffer params) {
|
||||
GL20.glGetUniform(program, location, params);
|
||||
}
|
||||
|
||||
public void glGetUniformiv(int program, int location, IntBuffer params) {
|
||||
GL20.glGetUniform(program, location, params);
|
||||
}
|
||||
|
||||
public void glGetVertexAttribPointerv(int index, int pname, Buffer pointer) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
public void glGetVertexAttribfv(int index, int pname, FloatBuffer params) {
|
||||
GL20.glGetVertexAttrib(index, pname, params);
|
||||
}
|
||||
|
||||
public void glGetVertexAttribiv(int index, int pname, IntBuffer params) {
|
||||
GL20.glGetVertexAttrib(index, pname, params);
|
||||
}
|
||||
|
||||
public void glHint(int target, int mode) {
|
||||
GL11.glHint(target, mode);
|
||||
}
|
||||
|
||||
public boolean glIsBuffer(int buffer) {
|
||||
return GL15.glIsBuffer(buffer);
|
||||
}
|
||||
|
||||
public boolean glIsEnabled(int cap) {
|
||||
return GL11.glIsEnabled(cap);
|
||||
}
|
||||
|
||||
public boolean glIsFramebuffer(int framebuffer) {
|
||||
return EXTFramebufferObject.glIsFramebufferEXT(framebuffer);
|
||||
}
|
||||
|
||||
public boolean glIsProgram(int program) {
|
||||
return GL20.glIsProgram(program);
|
||||
}
|
||||
|
||||
public boolean glIsRenderbuffer(int renderbuffer) {
|
||||
return EXTFramebufferObject.glIsRenderbufferEXT(renderbuffer);
|
||||
}
|
||||
|
||||
public boolean glIsShader(int shader) {
|
||||
return GL20.glIsShader(shader);
|
||||
}
|
||||
|
||||
public boolean glIsTexture(int texture) {
|
||||
return GL11.glIsTexture(texture);
|
||||
}
|
||||
|
||||
public void glLineWidth(float width) {
|
||||
GL11.glLineWidth(width);
|
||||
}
|
||||
|
||||
public void glLinkProgram(int program) {
|
||||
GL20.glLinkProgram(program);
|
||||
}
|
||||
|
||||
public void glPixelStorei(int pname, int param) {
|
||||
GL11.glPixelStorei(pname, param);
|
||||
}
|
||||
|
||||
public void glPolygonOffset(float factor, float units) {
|
||||
GL11.glPolygonOffset(factor, units);
|
||||
}
|
||||
|
||||
public void glReadPixels(int x, int y, int width, int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
if (pixels instanceof ByteBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (ByteBuffer) pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (ShortBuffer) pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (IntBuffer) pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (FloatBuffer) pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use "
|
||||
+ pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer or FloatBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glReleaseShaderCompiler() {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
public void glRenderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
EXTFramebufferObject.glRenderbufferStorageEXT(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
public void glSampleCoverage(float value, boolean invert) {
|
||||
GL13.glSampleCoverage(value, invert);
|
||||
}
|
||||
|
||||
public void glScissor(int x, int y, int width, int height) {
|
||||
GL11.glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
public void glShaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
public void glShaderSource(int shader, String string) {
|
||||
GL20.glShaderSource(shader, string);
|
||||
}
|
||||
|
||||
public void glStencilFunc(int func, int ref, int mask) {
|
||||
GL11.glStencilFunc(func, ref, mask);
|
||||
}
|
||||
|
||||
public void glStencilFuncSeparate(int face, int func, int ref, int mask) {
|
||||
GL20.glStencilFuncSeparate(face, func, ref, mask);
|
||||
}
|
||||
|
||||
public void glStencilMask(int mask) {
|
||||
GL11.glStencilMask(mask);
|
||||
}
|
||||
|
||||
public void glStencilMaskSeparate(int face, int mask) {
|
||||
GL20.glStencilMaskSeparate(face, mask);
|
||||
}
|
||||
|
||||
public void glStencilOp(int fail, int zfail, int zpass) {
|
||||
GL11.glStencilOp(fail, zfail, zpass);
|
||||
}
|
||||
|
||||
public void glStencilOpSeparate(int face, int fail, int zfail, int zpass) {
|
||||
GL20.glStencilOpSeparate(face, fail, zfail, zpass);
|
||||
}
|
||||
|
||||
public void glTexImage2D(int target, int level, int internalformat, int width, int height,
|
||||
int border, int format, int type,
|
||||
Buffer pixels) {
|
||||
if (pixels == null)
|
||||
GL11.glTexImage2D(target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
format,
|
||||
type,
|
||||
(ByteBuffer) null);
|
||||
else if (pixels instanceof ByteBuffer)
|
||||
GL11.glTexImage2D(target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
format,
|
||||
type,
|
||||
(ByteBuffer) pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glTexImage2D(target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
format,
|
||||
type,
|
||||
(ShortBuffer) pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glTexImage2D(target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
format,
|
||||
type,
|
||||
(IntBuffer) pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glTexImage2D(target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
format,
|
||||
type,
|
||||
(FloatBuffer) pixels);
|
||||
else if (pixels instanceof DoubleBuffer)
|
||||
GL11.glTexImage2D(target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
format,
|
||||
type,
|
||||
(DoubleBuffer) pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use "
|
||||
+ pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glTexParameterf(int target, int pname, float param) {
|
||||
GL11.glTexParameterf(target, pname, param);
|
||||
}
|
||||
|
||||
public void glTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
GL11.glTexParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public void glTexParameteri(int target, int pname, int param) {
|
||||
GL11.glTexParameteri(target, pname, param);
|
||||
}
|
||||
|
||||
public void glTexParameteriv(int target, int pname, IntBuffer params) {
|
||||
GL11.glTexParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width,
|
||||
int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
if (pixels instanceof ByteBuffer)
|
||||
GL11.glTexSubImage2D(target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
type,
|
||||
(ByteBuffer) pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glTexSubImage2D(target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
type,
|
||||
(ShortBuffer) pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glTexSubImage2D(target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
type,
|
||||
(IntBuffer) pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glTexSubImage2D(target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
type,
|
||||
(FloatBuffer) pixels);
|
||||
else if (pixels instanceof DoubleBuffer)
|
||||
GL11.glTexSubImage2D(target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
type,
|
||||
(DoubleBuffer) pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use "
|
||||
+ pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glUniform1f(int location, float x) {
|
||||
GL20.glUniform1f(location, x);
|
||||
}
|
||||
|
||||
public void glUniform1fv(int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform1(location, v);
|
||||
}
|
||||
|
||||
public void glUniform1i(int location, int x) {
|
||||
GL20.glUniform1i(location, x);
|
||||
}
|
||||
|
||||
public void glUniform1iv(int location, int count, IntBuffer v) {
|
||||
GL20.glUniform1(location, v);
|
||||
}
|
||||
|
||||
public void glUniform2f(int location, float x, float y) {
|
||||
GL20.glUniform2f(location, x, y);
|
||||
}
|
||||
|
||||
public void glUniform2fv(int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform2(location, v);
|
||||
}
|
||||
|
||||
public void glUniform2i(int location, int x, int y) {
|
||||
GL20.glUniform2i(location, x, y);
|
||||
}
|
||||
|
||||
public void glUniform2iv(int location, int count, IntBuffer v) {
|
||||
GL20.glUniform2(location, v);
|
||||
}
|
||||
|
||||
public void glUniform3f(int location, float x, float y, float z) {
|
||||
GL20.glUniform3f(location, x, y, z);
|
||||
}
|
||||
|
||||
public void glUniform3fv(int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform3(location, v);
|
||||
}
|
||||
|
||||
public void glUniform3i(int location, int x, int y, int z) {
|
||||
GL20.glUniform3i(location, x, y, z);
|
||||
}
|
||||
|
||||
public void glUniform3iv(int location, int count, IntBuffer v) {
|
||||
GL20.glUniform3(location, v);
|
||||
}
|
||||
|
||||
public void glUniform4f(int location, float x, float y, float z, float w) {
|
||||
GL20.glUniform4f(location, x, y, z, w);
|
||||
}
|
||||
|
||||
public void glUniform4fv(int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform4(location, v);
|
||||
}
|
||||
|
||||
public void glUniform4i(int location, int x, int y, int z, int w) {
|
||||
GL20.glUniform4i(location, x, y, z, w);
|
||||
}
|
||||
|
||||
public void glUniform4iv(int location, int count, IntBuffer v) {
|
||||
GL20.glUniform4(location, v);
|
||||
}
|
||||
|
||||
public void glUniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix2(location, transpose, value);
|
||||
}
|
||||
|
||||
public void glUniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix3(location, transpose, value);
|
||||
}
|
||||
|
||||
public void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix4(location, transpose, value);
|
||||
}
|
||||
|
||||
public void glUseProgram(int program) {
|
||||
GL20.glUseProgram(program);
|
||||
}
|
||||
|
||||
public void glValidateProgram(int program) {
|
||||
GL20.glValidateProgram(program);
|
||||
}
|
||||
|
||||
public void glVertexAttrib1f(int indx, float x) {
|
||||
GL20.glVertexAttrib1f(indx, x);
|
||||
}
|
||||
|
||||
public void glVertexAttrib1fv(int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib1f(indx, values.get());
|
||||
}
|
||||
|
||||
public void glVertexAttrib2f(int indx, float x, float y) {
|
||||
GL20.glVertexAttrib2f(indx, x, y);
|
||||
}
|
||||
|
||||
public void glVertexAttrib2fv(int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib2f(indx, values.get(), values.get());
|
||||
}
|
||||
|
||||
public void glVertexAttrib3f(int indx, float x, float y, float z) {
|
||||
GL20.glVertexAttrib3f(indx, x, y, z);
|
||||
}
|
||||
|
||||
public void glVertexAttrib3fv(int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib3f(indx, values.get(), values.get(), values.get());
|
||||
}
|
||||
|
||||
public void glVertexAttrib4f(int indx, float x, float y, float z, float w) {
|
||||
GL20.glVertexAttrib4f(indx, x, y, z, w);
|
||||
}
|
||||
|
||||
public void glVertexAttrib4fv(int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib4f(indx, values.get(), values.get(), values.get(), values.get());
|
||||
}
|
||||
|
||||
public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
Buffer buffer) {
|
||||
if (buffer instanceof ByteBuffer) {
|
||||
if (type == GL_BYTE)
|
||||
GL20.glVertexAttribPointer(indx,
|
||||
size,
|
||||
false,
|
||||
normalized,
|
||||
stride,
|
||||
(ByteBuffer) buffer);
|
||||
else if (type == GL_UNSIGNED_BYTE)
|
||||
GL20.glVertexAttribPointer(indx,
|
||||
size,
|
||||
true,
|
||||
normalized,
|
||||
stride,
|
||||
(ByteBuffer) buffer);
|
||||
else if (type == GL_SHORT)
|
||||
GL20.glVertexAttribPointer(indx,
|
||||
size,
|
||||
false,
|
||||
normalized,
|
||||
stride,
|
||||
((ByteBuffer) buffer).asShortBuffer());
|
||||
else if (type == GL_UNSIGNED_SHORT)
|
||||
GL20.glVertexAttribPointer(indx,
|
||||
size,
|
||||
true,
|
||||
normalized,
|
||||
stride,
|
||||
((ByteBuffer) buffer).asShortBuffer());
|
||||
else if (type == GL_FLOAT)
|
||||
GL20.glVertexAttribPointer(indx,
|
||||
size,
|
||||
normalized,
|
||||
stride,
|
||||
((ByteBuffer) buffer).asFloatBuffer());
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use "
|
||||
+ buffer.getClass().getName()
|
||||
+ " with type "
|
||||
+ type
|
||||
+ " with this method. Use ByteBuffer and one of GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT or GL_FLOAT for type. Blame LWJGL");
|
||||
} else
|
||||
throw new GdxRuntimeException("Can't use " + buffer.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glViewport(int x, int y, int width, int height) {
|
||||
GL11.glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
public void glDrawElements(int mode, int count, int type, int indices) {
|
||||
GL11.glDrawElements(mode, count, type, indices);
|
||||
}
|
||||
|
||||
public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
int ptr) {
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
|
||||
}
|
||||
|
||||
}
|
@ -1,742 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011 See AUTHORS file.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
package org.oscim.gdx;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL13;
|
||||
import org.lwjgl.opengl.GL14;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
import com.badlogic.gdx.graphics.GL10;
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
|
||||
/** An implementation of the {@link GL20} interface based on LWJGL. Note that LWJGL shaders and OpenGL ES shaders will not be 100%
|
||||
* compatible. Some glGetXXX methods are not implemented.
|
||||
*
|
||||
* @author mzechner */
|
||||
public final class GdxGLAdapter implements org.oscim.backend.GL20 {
|
||||
public void glActiveTexture (int texture) {
|
||||
GL13.glActiveTexture(texture);
|
||||
}
|
||||
|
||||
public void glAttachShader (int program, int shader) {
|
||||
GL20.glAttachShader(program, shader);
|
||||
}
|
||||
|
||||
public void glBindAttribLocation (int program, int index, String name) {
|
||||
GL20.glBindAttribLocation(program, index, name);
|
||||
}
|
||||
|
||||
public void glBindBuffer (int target, int buffer) {
|
||||
GL15.glBindBuffer(target, buffer);
|
||||
}
|
||||
|
||||
public void glBindFramebuffer (int target, int framebuffer) {
|
||||
EXTFramebufferObject.glBindFramebufferEXT(target, framebuffer);
|
||||
}
|
||||
|
||||
public void glBindRenderbuffer (int target, int renderbuffer) {
|
||||
EXTFramebufferObject.glBindRenderbufferEXT(target, renderbuffer);
|
||||
}
|
||||
|
||||
public void glBindTexture (int target, int texture) {
|
||||
GL11.glBindTexture(target, texture);
|
||||
}
|
||||
|
||||
public void glBlendColor (float red, float green, float blue, float alpha) {
|
||||
GL14.glBlendColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void glBlendEquation (int mode) {
|
||||
GL14.glBlendEquation(mode);
|
||||
}
|
||||
|
||||
public void glBlendEquationSeparate (int modeRGB, int modeAlpha) {
|
||||
GL20.glBlendEquationSeparate(modeRGB, modeAlpha);
|
||||
}
|
||||
|
||||
public void glBlendFunc (int sfactor, int dfactor) {
|
||||
GL11.glBlendFunc(sfactor, dfactor);
|
||||
}
|
||||
|
||||
public void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
|
||||
GL14.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
public void glBufferData (int target, int size, Buffer data, int usage) {
|
||||
if(data == null)
|
||||
throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL");
|
||||
else if (data instanceof ByteBuffer)
|
||||
GL15.glBufferData(target, (ByteBuffer)data, usage);
|
||||
else if (data instanceof IntBuffer)
|
||||
GL15.glBufferData(target, (IntBuffer)data, usage);
|
||||
else if (data instanceof FloatBuffer)
|
||||
GL15.glBufferData(target, (FloatBuffer)data, usage);
|
||||
else if (data instanceof DoubleBuffer)
|
||||
GL15.glBufferData(target, (DoubleBuffer)data, usage);
|
||||
else if (data instanceof ShortBuffer) //
|
||||
GL15.glBufferData(target, (ShortBuffer)data, usage);
|
||||
}
|
||||
|
||||
public void glBufferSubData (int target, int offset, int size, Buffer data) {
|
||||
if(data == null)
|
||||
throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL");
|
||||
else if (data instanceof ByteBuffer)
|
||||
GL15.glBufferSubData(target, offset, (ByteBuffer)data);
|
||||
else if (data instanceof IntBuffer)
|
||||
GL15.glBufferSubData(target, offset, (IntBuffer)data);
|
||||
else if (data instanceof FloatBuffer)
|
||||
GL15.glBufferSubData(target, offset, (FloatBuffer)data);
|
||||
else if (data instanceof DoubleBuffer)
|
||||
GL15.glBufferSubData(target, offset, (DoubleBuffer)data);
|
||||
else if (data instanceof ShortBuffer) //
|
||||
GL15.glBufferSubData(target, offset, (ShortBuffer)data);
|
||||
}
|
||||
|
||||
public int glCheckFramebufferStatus (int target) {
|
||||
return EXTFramebufferObject.glCheckFramebufferStatusEXT(target);
|
||||
}
|
||||
|
||||
public void glClear (int mask) {
|
||||
GL11.glClear(mask);
|
||||
}
|
||||
|
||||
public void glClearColor (float red, float green, float blue, float alpha) {
|
||||
GL11.glClearColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void glClearDepthf (float depth) {
|
||||
GL11.glClearDepth(depth);
|
||||
}
|
||||
|
||||
public void glClearStencil (int s) {
|
||||
GL11.glClearStencil(s);
|
||||
}
|
||||
|
||||
public void glColorMask (boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
GL11.glColorMask(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void glCompileShader (int shader) {
|
||||
GL20.glCompileShader(shader);
|
||||
}
|
||||
|
||||
public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border,
|
||||
int imageSize, Buffer data) {
|
||||
if (data instanceof ByteBuffer) {
|
||||
GL13.glCompressedTexImage2D(target, level, internalformat, width, height, border, (ByteBuffer)data);
|
||||
} else {
|
||||
throw new GdxRuntimeException("Can't use " + data.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer instead.");
|
||||
}
|
||||
}
|
||||
|
||||
public void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format,
|
||||
int imageSize, Buffer data) {
|
||||
throw new GdxRuntimeException("not implemented");
|
||||
}
|
||||
|
||||
public void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) {
|
||||
GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
|
||||
}
|
||||
|
||||
public void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) {
|
||||
GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
public int glCreateProgram () {
|
||||
return GL20.glCreateProgram();
|
||||
}
|
||||
|
||||
public int glCreateShader (int type) {
|
||||
return GL20.glCreateShader(type);
|
||||
}
|
||||
|
||||
public void glCullFace (int mode) {
|
||||
GL11.glCullFace(mode);
|
||||
}
|
||||
|
||||
public void glDeleteBuffers (int n, IntBuffer buffers) {
|
||||
GL15.glDeleteBuffers(buffers);
|
||||
}
|
||||
|
||||
public void glDeleteFramebuffers (int n, IntBuffer framebuffers) {
|
||||
EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffers);
|
||||
}
|
||||
|
||||
public void glDeleteProgram (int program) {
|
||||
GL20.glDeleteProgram(program);
|
||||
}
|
||||
|
||||
public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers) {
|
||||
EXTFramebufferObject.glDeleteRenderbuffersEXT(renderbuffers);
|
||||
}
|
||||
|
||||
public void glDeleteShader (int shader) {
|
||||
GL20.glDeleteShader(shader);
|
||||
}
|
||||
|
||||
public void glDeleteTextures (int n, IntBuffer textures) {
|
||||
GL11.glDeleteTextures(textures);
|
||||
}
|
||||
|
||||
public void glDepthFunc (int func) {
|
||||
GL11.glDepthFunc(func);
|
||||
}
|
||||
|
||||
public void glDepthMask (boolean flag) {
|
||||
GL11.glDepthMask(flag);
|
||||
}
|
||||
|
||||
public void glDepthRangef (float zNear, float zFar) {
|
||||
GL11.glDepthRange(zNear, zFar);
|
||||
}
|
||||
|
||||
public void glDetachShader (int program, int shader) {
|
||||
GL20.glDetachShader(program, shader);
|
||||
}
|
||||
|
||||
public void glDisable (int cap) {
|
||||
GL11.glDisable(cap);
|
||||
}
|
||||
|
||||
public void glDisableVertexAttribArray (int index) {
|
||||
GL20.glDisableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public void glDrawArrays (int mode, int first, int count) {
|
||||
GL11.glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
public void glDrawElements (int mode, int count, int type, Buffer indices) {
|
||||
if (indices instanceof ShortBuffer && type == GL10.GL_UNSIGNED_SHORT)
|
||||
GL11.glDrawElements(mode, (ShortBuffer)indices);
|
||||
else if (indices instanceof ByteBuffer && type == GL10.GL_UNSIGNED_SHORT)
|
||||
GL11.glDrawElements(mode, ((ByteBuffer)indices).asShortBuffer()); // FIXME yay...
|
||||
else if (indices instanceof ByteBuffer && type == GL10.GL_UNSIGNED_BYTE)
|
||||
GL11.glDrawElements(mode, (ByteBuffer)indices);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + indices.getClass().getName()
|
||||
+ " with this method. Use ShortBuffer or ByteBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glEnable (int cap) {
|
||||
GL11.glEnable(cap);
|
||||
}
|
||||
|
||||
public void glEnableVertexAttribArray (int index) {
|
||||
GL20.glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public void glFinish () {
|
||||
GL11.glFinish();
|
||||
}
|
||||
|
||||
public void glFlush () {
|
||||
GL11.glFlush();
|
||||
}
|
||||
|
||||
public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer) {
|
||||
EXTFramebufferObject.glFramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
|
||||
}
|
||||
|
||||
public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level) {
|
||||
EXTFramebufferObject.glFramebufferTexture2DEXT(target, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
public void glFrontFace (int mode) {
|
||||
GL11.glFrontFace(mode);
|
||||
}
|
||||
|
||||
public void glGenBuffers (int n, IntBuffer buffers) {
|
||||
GL15.glGenBuffers(buffers);
|
||||
}
|
||||
|
||||
public void glGenFramebuffers (int n, IntBuffer framebuffers) {
|
||||
EXTFramebufferObject.glGenFramebuffersEXT(framebuffers);
|
||||
}
|
||||
|
||||
public void glGenRenderbuffers (int n, IntBuffer renderbuffers) {
|
||||
EXTFramebufferObject.glGenRenderbuffersEXT(renderbuffers);
|
||||
}
|
||||
|
||||
public void glGenTextures (int n, IntBuffer textures) {
|
||||
GL11.glGenTextures(textures);
|
||||
}
|
||||
|
||||
public void glGenerateMipmap (int target) {
|
||||
EXTFramebufferObject.glGenerateMipmapEXT(target);
|
||||
}
|
||||
|
||||
public String glGetActiveAttrib (int program, int index, IntBuffer size, Buffer type) {
|
||||
// FIXME this is less than ideal of course...
|
||||
IntBuffer typeTmp = BufferUtils.createIntBuffer(2);
|
||||
String name = GL20.glGetActiveAttrib(program, index, 256, typeTmp);
|
||||
if (type instanceof IntBuffer) ((IntBuffer)type).put(typeTmp.get(0));
|
||||
return name;
|
||||
}
|
||||
|
||||
public String glGetActiveUniform (int program, int index, IntBuffer size, Buffer type) {
|
||||
// FIXME this is less than ideal of course...
|
||||
IntBuffer typeTmp = BufferUtils.createIntBuffer(2);
|
||||
String name = GL20.glGetActiveUniform(program, index, 256, typeTmp);
|
||||
if (type instanceof IntBuffer) ((IntBuffer)type).put(typeTmp.get(0));
|
||||
return name;
|
||||
}
|
||||
|
||||
public void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders) {
|
||||
GL20.glGetAttachedShaders(program, (IntBuffer)count, shaders);
|
||||
}
|
||||
|
||||
public int glGetAttribLocation (int program, String name) {
|
||||
return GL20.glGetAttribLocation(program, name);
|
||||
}
|
||||
|
||||
public void glGetBooleanv (int pname, Buffer params) {
|
||||
GL11.glGetBoolean(pname, (ByteBuffer)params);
|
||||
}
|
||||
|
||||
public void glGetBufferParameteriv (int target, int pname, IntBuffer params) {
|
||||
GL15.glGetBufferParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public int glGetError () {
|
||||
return GL11.glGetError();
|
||||
}
|
||||
|
||||
public void glGetFloatv (int pname, FloatBuffer params) {
|
||||
GL11.glGetFloat(pname, params);
|
||||
}
|
||||
|
||||
public void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params) {
|
||||
EXTFramebufferObject.glGetFramebufferAttachmentParameterEXT(target, attachment, pname, params);
|
||||
}
|
||||
|
||||
public void glGetIntegerv (int pname, IntBuffer params) {
|
||||
GL11.glGetInteger(pname, params);
|
||||
}
|
||||
|
||||
public String glGetProgramInfoLog (int program) {
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
|
||||
buffer.order(ByteOrder.nativeOrder());
|
||||
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
|
||||
tmp.order(ByteOrder.nativeOrder());
|
||||
IntBuffer intBuffer = tmp.asIntBuffer();
|
||||
|
||||
GL20.glGetProgramInfoLog(program, intBuffer, buffer);
|
||||
int numBytes = intBuffer.get(0);
|
||||
byte[] bytes = new byte[numBytes];
|
||||
buffer.get(bytes);
|
||||
return new String(bytes);
|
||||
}
|
||||
|
||||
public void glGetProgramiv (int program, int pname, IntBuffer params) {
|
||||
GL20.glGetProgram(program, pname, params);
|
||||
}
|
||||
|
||||
public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params) {
|
||||
EXTFramebufferObject.glGetRenderbufferParameterEXT(target, pname, params);
|
||||
}
|
||||
|
||||
public String glGetShaderInfoLog (int shader) {
|
||||
ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 10);
|
||||
buffer.order(ByteOrder.nativeOrder());
|
||||
ByteBuffer tmp = ByteBuffer.allocateDirect(4);
|
||||
tmp.order(ByteOrder.nativeOrder());
|
||||
IntBuffer intBuffer = tmp.asIntBuffer();
|
||||
|
||||
GL20.glGetShaderInfoLog(shader, intBuffer, buffer);
|
||||
int numBytes = intBuffer.get(0);
|
||||
byte[] bytes = new byte[numBytes];
|
||||
buffer.get(bytes);
|
||||
return new String(bytes);
|
||||
}
|
||||
|
||||
public void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
public void glGetShaderSource (int shader, int bufsize, Buffer length, String source) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement.");
|
||||
}
|
||||
|
||||
public void glGetShaderiv (int shader, int pname, IntBuffer params) {
|
||||
GL20.glGetShader(shader, pname, params);
|
||||
}
|
||||
|
||||
public String glGetString (int name) {
|
||||
return GL11.glGetString(name);
|
||||
}
|
||||
|
||||
public void glGetTexParameterfv (int target, int pname, FloatBuffer params) {
|
||||
GL11.glGetTexParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public void glGetTexParameteriv (int target, int pname, IntBuffer params) {
|
||||
GL11.glGetTexParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public int glGetUniformLocation (int program, String name) {
|
||||
return GL20.glGetUniformLocation(program, name);
|
||||
}
|
||||
|
||||
public void glGetUniformfv (int program, int location, FloatBuffer params) {
|
||||
GL20.glGetUniform(program, location, params);
|
||||
}
|
||||
|
||||
public void glGetUniformiv (int program, int location, IntBuffer params) {
|
||||
GL20.glGetUniform(program, location, params);
|
||||
}
|
||||
|
||||
public void glGetVertexAttribPointerv (int index, int pname, Buffer pointer) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
public void glGetVertexAttribfv (int index, int pname, FloatBuffer params) {
|
||||
GL20.glGetVertexAttrib(index, pname, params);
|
||||
}
|
||||
|
||||
public void glGetVertexAttribiv (int index, int pname, IntBuffer params) {
|
||||
GL20.glGetVertexAttrib(index, pname, params);
|
||||
}
|
||||
|
||||
public void glHint (int target, int mode) {
|
||||
GL11.glHint(target, mode);
|
||||
}
|
||||
|
||||
public boolean glIsBuffer (int buffer) {
|
||||
return GL15.glIsBuffer(buffer);
|
||||
}
|
||||
|
||||
public boolean glIsEnabled (int cap) {
|
||||
return GL11.glIsEnabled(cap);
|
||||
}
|
||||
|
||||
public boolean glIsFramebuffer (int framebuffer) {
|
||||
return EXTFramebufferObject.glIsFramebufferEXT(framebuffer);
|
||||
}
|
||||
|
||||
public boolean glIsProgram (int program) {
|
||||
return GL20.glIsProgram(program);
|
||||
}
|
||||
|
||||
public boolean glIsRenderbuffer (int renderbuffer) {
|
||||
return EXTFramebufferObject.glIsRenderbufferEXT(renderbuffer);
|
||||
}
|
||||
|
||||
public boolean glIsShader (int shader) {
|
||||
return GL20.glIsShader(shader);
|
||||
}
|
||||
|
||||
public boolean glIsTexture (int texture) {
|
||||
return GL11.glIsTexture(texture);
|
||||
}
|
||||
|
||||
public void glLineWidth (float width) {
|
||||
GL11.glLineWidth(width);
|
||||
}
|
||||
|
||||
public void glLinkProgram (int program) {
|
||||
GL20.glLinkProgram(program);
|
||||
}
|
||||
|
||||
public void glPixelStorei (int pname, int param) {
|
||||
GL11.glPixelStorei(pname, param);
|
||||
}
|
||||
|
||||
public void glPolygonOffset (float factor, float units) {
|
||||
GL11.glPolygonOffset(factor, units);
|
||||
}
|
||||
|
||||
public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels) {
|
||||
if (pixels instanceof ByteBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (ByteBuffer)pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (ShortBuffer)pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (IntBuffer)pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glReadPixels(x, y, width, height, format, type, (FloatBuffer)pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer or FloatBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glReleaseShaderCompiler () {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
public void glRenderbufferStorage (int target, int internalformat, int width, int height) {
|
||||
EXTFramebufferObject.glRenderbufferStorageEXT(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
public void glSampleCoverage (float value, boolean invert) {
|
||||
GL13.glSampleCoverage(value, invert);
|
||||
}
|
||||
|
||||
public void glScissor (int x, int y, int width, int height) {
|
||||
GL11.glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
public void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
|
||||
throw new UnsupportedOperationException("unsupported, won't implement");
|
||||
}
|
||||
|
||||
public void glShaderSource (int shader, String string) {
|
||||
GL20.glShaderSource(shader, string);
|
||||
}
|
||||
|
||||
public void glStencilFunc (int func, int ref, int mask) {
|
||||
GL11.glStencilFunc(func, ref, mask);
|
||||
}
|
||||
|
||||
public void glStencilFuncSeparate (int face, int func, int ref, int mask) {
|
||||
GL20.glStencilFuncSeparate(face, func, ref, mask);
|
||||
}
|
||||
|
||||
public void glStencilMask (int mask) {
|
||||
GL11.glStencilMask(mask);
|
||||
}
|
||||
|
||||
public void glStencilMaskSeparate (int face, int mask) {
|
||||
GL20.glStencilMaskSeparate(face, mask);
|
||||
}
|
||||
|
||||
public void glStencilOp (int fail, int zfail, int zpass) {
|
||||
GL11.glStencilOp(fail, zfail, zpass);
|
||||
}
|
||||
|
||||
public void glStencilOpSeparate (int face, int fail, int zfail, int zpass) {
|
||||
GL20.glStencilOpSeparate(face, fail, zfail, zpass);
|
||||
}
|
||||
|
||||
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
|
||||
Buffer pixels) {
|
||||
if (pixels == null)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer)null);
|
||||
else if (pixels instanceof ByteBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ByteBuffer)pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (ShortBuffer)pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (IntBuffer)pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (FloatBuffer)pixels);
|
||||
else if (pixels instanceof DoubleBuffer)
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, (DoubleBuffer)pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glTexParameterf (int target, int pname, float param) {
|
||||
GL11.glTexParameterf(target, pname, param);
|
||||
}
|
||||
|
||||
public void glTexParameterfv (int target, int pname, FloatBuffer params) {
|
||||
GL11.glTexParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public void glTexParameteri (int target, int pname, int param) {
|
||||
GL11.glTexParameteri(target, pname, param);
|
||||
}
|
||||
|
||||
public void glTexParameteriv (int target, int pname, IntBuffer params) {
|
||||
GL11.glTexParameter(target, pname, params);
|
||||
}
|
||||
|
||||
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
if (pixels instanceof ByteBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ByteBuffer)pixels);
|
||||
else if (pixels instanceof ShortBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (ShortBuffer)pixels);
|
||||
else if (pixels instanceof IntBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (IntBuffer)pixels);
|
||||
else if (pixels instanceof FloatBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (FloatBuffer)pixels);
|
||||
else if (pixels instanceof DoubleBuffer)
|
||||
GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, (DoubleBuffer)pixels);
|
||||
else
|
||||
throw new GdxRuntimeException("Can't use " + pixels.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glUniform1f (int location, float x) {
|
||||
GL20.glUniform1f(location, x);
|
||||
}
|
||||
|
||||
public void glUniform1fv (int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform1(location, v);
|
||||
}
|
||||
|
||||
public void glUniform1i (int location, int x) {
|
||||
GL20.glUniform1i(location, x);
|
||||
}
|
||||
|
||||
public void glUniform1iv (int location, int count, IntBuffer v) {
|
||||
GL20.glUniform1(location, v);
|
||||
}
|
||||
|
||||
public void glUniform2f (int location, float x, float y) {
|
||||
GL20.glUniform2f(location, x, y);
|
||||
}
|
||||
|
||||
public void glUniform2fv (int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform2(location, v);
|
||||
}
|
||||
|
||||
public void glUniform2i (int location, int x, int y) {
|
||||
GL20.glUniform2i(location, x, y);
|
||||
}
|
||||
|
||||
public void glUniform2iv (int location, int count, IntBuffer v) {
|
||||
GL20.glUniform2(location, v);
|
||||
}
|
||||
|
||||
public void glUniform3f (int location, float x, float y, float z) {
|
||||
GL20.glUniform3f(location, x, y, z);
|
||||
}
|
||||
|
||||
public void glUniform3fv (int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform3(location, v);
|
||||
}
|
||||
|
||||
public void glUniform3i (int location, int x, int y, int z) {
|
||||
GL20.glUniform3i(location, x, y, z);
|
||||
}
|
||||
|
||||
public void glUniform3iv (int location, int count, IntBuffer v) {
|
||||
GL20.glUniform3(location, v);
|
||||
}
|
||||
|
||||
public void glUniform4f (int location, float x, float y, float z, float w) {
|
||||
GL20.glUniform4f(location, x, y, z, w);
|
||||
}
|
||||
|
||||
public void glUniform4fv (int location, int count, FloatBuffer v) {
|
||||
GL20.glUniform4(location, v);
|
||||
}
|
||||
|
||||
public void glUniform4i (int location, int x, int y, int z, int w) {
|
||||
GL20.glUniform4i(location, x, y, z, w);
|
||||
}
|
||||
|
||||
public void glUniform4iv (int location, int count, IntBuffer v) {
|
||||
GL20.glUniform4(location, v);
|
||||
}
|
||||
|
||||
public void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix2(location, transpose, value);
|
||||
}
|
||||
|
||||
public void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix3(location, transpose, value);
|
||||
}
|
||||
|
||||
public void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GL20.glUniformMatrix4(location, transpose, value);
|
||||
}
|
||||
|
||||
public void glUseProgram (int program) {
|
||||
GL20.glUseProgram(program);
|
||||
}
|
||||
|
||||
public void glValidateProgram (int program) {
|
||||
GL20.glValidateProgram(program);
|
||||
}
|
||||
|
||||
public void glVertexAttrib1f (int indx, float x) {
|
||||
GL20.glVertexAttrib1f(indx, x);
|
||||
}
|
||||
|
||||
public void glVertexAttrib1fv (int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib1f(indx, values.get());
|
||||
}
|
||||
|
||||
public void glVertexAttrib2f (int indx, float x, float y) {
|
||||
GL20.glVertexAttrib2f(indx, x, y);
|
||||
}
|
||||
|
||||
public void glVertexAttrib2fv (int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib2f(indx, values.get(), values.get());
|
||||
}
|
||||
|
||||
public void glVertexAttrib3f (int indx, float x, float y, float z) {
|
||||
GL20.glVertexAttrib3f(indx, x, y, z);
|
||||
}
|
||||
|
||||
public void glVertexAttrib3fv (int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib3f(indx, values.get(), values.get(), values.get());
|
||||
}
|
||||
|
||||
public void glVertexAttrib4f (int indx, float x, float y, float z, float w) {
|
||||
GL20.glVertexAttrib4f(indx, x, y, z, w);
|
||||
}
|
||||
|
||||
public void glVertexAttrib4fv (int indx, FloatBuffer values) {
|
||||
GL20.glVertexAttrib4f(indx, values.get(), values.get(), values.get(), values.get());
|
||||
}
|
||||
|
||||
public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer buffer) {
|
||||
if (buffer instanceof ByteBuffer) {
|
||||
if (type == GL_BYTE)
|
||||
GL20.glVertexAttribPointer(indx, size, false, normalized, stride, (ByteBuffer)buffer);
|
||||
else if (type == GL_UNSIGNED_BYTE)
|
||||
GL20.glVertexAttribPointer(indx, size, true, normalized, stride, (ByteBuffer)buffer);
|
||||
else if (type == GL_SHORT)
|
||||
GL20.glVertexAttribPointer(indx, size, false, normalized, stride, ((ByteBuffer)buffer).asShortBuffer());
|
||||
else if (type == GL_UNSIGNED_SHORT)
|
||||
GL20.glVertexAttribPointer(indx, size, true, normalized, stride, ((ByteBuffer)buffer).asShortBuffer());
|
||||
else if (type == GL_FLOAT)
|
||||
GL20.glVertexAttribPointer(indx, size, normalized, stride, ((ByteBuffer)buffer).asFloatBuffer());
|
||||
else
|
||||
throw new GdxRuntimeException(
|
||||
"Can't use "
|
||||
+ buffer.getClass().getName()
|
||||
+ " with type "
|
||||
+ type
|
||||
+ " with this method. Use ByteBuffer and one of GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT or GL_FLOAT for type. Blame LWJGL");
|
||||
} else
|
||||
throw new GdxRuntimeException("Can't use " + buffer.getClass().getName()
|
||||
+ " with this method. Use ByteBuffer instead. Blame LWJGL");
|
||||
}
|
||||
|
||||
public void glViewport (int x, int y, int width, int height) {
|
||||
GL11.glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
public void glDrawElements (int mode, int count, int type, int indices) {
|
||||
GL11.glDrawElements(mode, count, type, indices);
|
||||
}
|
||||
|
||||
public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr) {
|
||||
GL20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
|
||||
}
|
||||
|
||||
}
|
@ -18,7 +18,7 @@ public class GdxMapApp extends GdxMap {
|
||||
// set our globals
|
||||
new SharedLibraryLoader().load("vtm-jni");
|
||||
CanvasAdapter.g = AwtGraphics.INSTANCE;
|
||||
GLAdapter.g = new GdxGLAdapter();
|
||||
GLAdapter.g = new GdxGL20();
|
||||
GLAdapter.GDX_DESKTOP_QUIRKS = true;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@ public class GwtBitmap implements Bitmap {
|
||||
Pixmap pixmap;
|
||||
Image image;
|
||||
boolean disposable;
|
||||
|
||||
public GwtBitmap(Image data) {
|
||||
ImageElement imageElement = ImageElement.as(data.getElement());
|
||||
pixmap = new Pixmap(imageElement);
|
||||
@ -63,9 +64,8 @@ public class GwtBitmap implements Bitmap {
|
||||
pixmap.getHeight(), 0,
|
||||
pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
|
||||
|
||||
|
||||
if (disposable || image != null){
|
||||
Log.d("", "dispose pixmap " +getWidth() +"/" + getHeight());
|
||||
if (disposable || image != null) {
|
||||
Log.d("", "dispose pixmap " + getWidth() + "/" + getHeight());
|
||||
pixmap.dispose();
|
||||
|
||||
if (image != null)
|
||||
|
@ -19,8 +19,8 @@ public class GwtLauncher extends GwtApplication {
|
||||
|
||||
@Override
|
||||
public GwtApplicationConfiguration getConfig() {
|
||||
GwtApplicationConfiguration cfg = new GwtApplicationConfiguration(
|
||||
GwtGraphics.getWindowWidthJSNI(),
|
||||
GwtApplicationConfiguration cfg =
|
||||
new GwtApplicationConfiguration(GwtGraphics.getWindowWidthJSNI(),
|
||||
GwtGraphics.getWindowHeightJSNI());
|
||||
|
||||
DockLayoutPanel p = new DockLayoutPanel(Unit.EM);
|
||||
|
@ -47,7 +47,7 @@ public class GwtPaint implements Paint {
|
||||
float a = ((color >>> 24) & 0xff) / 255f;
|
||||
int r = (color >>> 16) & 0xff;
|
||||
int g = (color >>> 8) & 0xff;
|
||||
int b = (color & 0xff) ;
|
||||
int b = (color & 0xff);
|
||||
|
||||
this.color = Pixmap.make(r, g, b, a);
|
||||
}
|
||||
@ -105,7 +105,7 @@ public class GwtPaint implements Paint {
|
||||
return 4 + strokeWidth;
|
||||
}
|
||||
|
||||
void buildFont(){
|
||||
void buildFont() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (this.fontStyle == FontStyle.BOLD)
|
||||
|
@ -34,4 +34,3 @@ class MapConfig extends JavaScriptObject {
|
||||
return this.background;
|
||||
}-*/;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,8 @@ public class SearchBox {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final native String getId() /*-{
|
||||
public final native String getId()
|
||||
/*-{
|
||||
return this.osm_id;
|
||||
}-*/;
|
||||
|
||||
|
@ -204,21 +204,21 @@ public class WKTReader {
|
||||
return neg ? -val : val;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// WKTReader r = new WKTReader();
|
||||
// GeometryBuffer geom = new GeometryBuffer(10, 10);
|
||||
// try {
|
||||
// String wkt = "MULTIPOINT(0 0,1 0)";
|
||||
// r.parse(wkt, geom);
|
||||
// for (int i = 0; i < geom.index.length; i++) {
|
||||
// int len = geom.index[i];
|
||||
// if (len < 0)
|
||||
// break;
|
||||
// for (int p = 0; p < len; p += 2)
|
||||
// System.out.println(len + ": " + geom.points[p] + "," + geom.points[p + 1]);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// public static void main(String[] args) {
|
||||
// WKTReader r = new WKTReader();
|
||||
// GeometryBuffer geom = new GeometryBuffer(10, 10);
|
||||
// try {
|
||||
// String wkt = "MULTIPOINT(0 0,1 0)";
|
||||
// r.parse(wkt, geom);
|
||||
// for (int i = 0; i < geom.index.length; i++) {
|
||||
// int len = geom.index[i];
|
||||
// if (len < 0)
|
||||
// break;
|
||||
// for (int p = 0; p < len; p += 2)
|
||||
// System.out.println(len + ": " + geom.points[p] + "," + geom.points[p + 1]);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -7,5 +7,4 @@ public class MalformedURLException extends Exception {
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ import org.xml.sax.Attributes;
|
||||
import com.google.gwt.xml.client.NamedNodeMap;
|
||||
import com.google.gwt.xml.client.Node;
|
||||
|
||||
public class MyAttributes implements Attributes{
|
||||
public class MyAttributes implements Attributes {
|
||||
private NamedNodeMap map;
|
||||
|
||||
public MyAttributes(Node n){
|
||||
public MyAttributes(Node n) {
|
||||
map = n.getAttributes();
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
|
||||
public class GLMatrix {
|
||||
|
||||
public static final int M00 = 0;// 0;
|
||||
@ -41,21 +40,27 @@ public class GLMatrix {
|
||||
public static final int M32 = 11;// 14;
|
||||
public static final int M33 = 15;// 15;
|
||||
|
||||
private final FloatBuffer buffer = ByteBuffer.allocateDirect(16 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
||||
|
||||
private final FloatBuffer buffer = ByteBuffer.allocateDirect(16 * 4)
|
||||
.order(ByteOrder.nativeOrder())
|
||||
.asFloatBuffer();
|
||||
|
||||
private final static String INVALID_INPUT = "Bad Array!";
|
||||
|
||||
public final float tmp[] = new float[16];
|
||||
public final float val[] = new float[16];
|
||||
|
||||
/** Sets the matrix to the given matrix as a float array. The float array must have at least 16 elements; the first 16 will be
|
||||
/**
|
||||
* Sets the matrix to the given matrix as a float array. The float array
|
||||
* must have at least 16 elements; the first 16 will be
|
||||
* copied.
|
||||
*
|
||||
* @param values The matrix, in float form, that is to be copied. Remember that this matrix is in <a
|
||||
* href="http://en.wikipedia.org/wiki/Row-major_order">column major</a> order.
|
||||
* @return This matrix for the purpose of chaining methods together. */
|
||||
public void set (float[] values) {
|
||||
* @param values The matrix, in float form, that is to be copied. Remember
|
||||
* that this matrix is in <a
|
||||
* href="http://en.wikipedia.org/wiki/Row-major_order">column
|
||||
* major</a> order.
|
||||
* @return This matrix for the purpose of chaining methods together.
|
||||
*/
|
||||
public void set(float[] values) {
|
||||
val[M00] = values[M00];
|
||||
val[M10] = values[M10];
|
||||
val[M20] = values[M20];
|
||||
@ -73,6 +78,7 @@ public class GLMatrix {
|
||||
val[M23] = values[M23];
|
||||
val[M33] = values[M33];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Matrix as float array
|
||||
*
|
||||
@ -110,7 +116,7 @@ public class GLMatrix {
|
||||
matrix4_proj(val, vec3);
|
||||
}
|
||||
|
||||
static void matrix4_proj (float[] mat, float[] vec) {
|
||||
static void matrix4_proj(float[] mat, float[] vec) {
|
||||
float inv_w = 1.0f / (vec[0] * mat[M30] + vec[1] * mat[M31] + vec[2] * mat[M32] + mat[M33]);
|
||||
float x = (vec[0] * mat[M00] + vec[1] * mat[M01] + vec[2] * mat[M02] + mat[M03]) * inv_w;
|
||||
float y = (vec[0] * mat[M10] + vec[1] * mat[M11] + vec[2] * mat[M12] + mat[M13]) * inv_w;
|
||||
@ -258,7 +264,9 @@ public class GLMatrix {
|
||||
public void setValue(int pos, float value) {
|
||||
val[pos] = value;
|
||||
}
|
||||
|
||||
static float PiTimesThumb = 1.0f / (1 << 11);
|
||||
|
||||
/**
|
||||
* add some offset (similar to glDepthOffset)
|
||||
*
|
||||
@ -290,32 +298,48 @@ public class GLMatrix {
|
||||
val[M33] = 1;
|
||||
}
|
||||
|
||||
static void matrix4_mul (float[] mata, float[] matb) {
|
||||
static void matrix4_mul(float[] mata, float[] matb) {
|
||||
float tmp[] = new float[16];
|
||||
tmp[M00] = mata[M00] * matb[M00] + mata[M01] * matb[M10] + mata[M02] * matb[M20] + mata[M03] * matb[M30];
|
||||
tmp[M01] = mata[M00] * matb[M01] + mata[M01] * matb[M11] + mata[M02] * matb[M21] + mata[M03] * matb[M31];
|
||||
tmp[M02] = mata[M00] * matb[M02] + mata[M01] * matb[M12] + mata[M02] * matb[M22] + mata[M03] * matb[M32];
|
||||
tmp[M03] = mata[M00] * matb[M03] + mata[M01] * matb[M13] + mata[M02] * matb[M23] + mata[M03] * matb[M33];
|
||||
tmp[M10] = mata[M10] * matb[M00] + mata[M11] * matb[M10] + mata[M12] * matb[M20] + mata[M13] * matb[M30];
|
||||
tmp[M11] = mata[M10] * matb[M01] + mata[M11] * matb[M11] + mata[M12] * matb[M21] + mata[M13] * matb[M31];
|
||||
tmp[M12] = mata[M10] * matb[M02] + mata[M11] * matb[M12] + mata[M12] * matb[M22] + mata[M13] * matb[M32];
|
||||
tmp[M13] = mata[M10] * matb[M03] + mata[M11] * matb[M13] + mata[M12] * matb[M23] + mata[M13] * matb[M33];
|
||||
tmp[M20] = mata[M20] * matb[M00] + mata[M21] * matb[M10] + mata[M22] * matb[M20] + mata[M23] * matb[M30];
|
||||
tmp[M21] = mata[M20] * matb[M01] + mata[M21] * matb[M11] + mata[M22] * matb[M21] + mata[M23] * matb[M31];
|
||||
tmp[M22] = mata[M20] * matb[M02] + mata[M21] * matb[M12] + mata[M22] * matb[M22] + mata[M23] * matb[M32];
|
||||
tmp[M23] = mata[M20] * matb[M03] + mata[M21] * matb[M13] + mata[M22] * matb[M23] + mata[M23] * matb[M33];
|
||||
tmp[M30] = mata[M30] * matb[M00] + mata[M31] * matb[M10] + mata[M32] * matb[M20] + mata[M33] * matb[M30];
|
||||
tmp[M31] = mata[M30] * matb[M01] + mata[M31] * matb[M11] + mata[M32] * matb[M21] + mata[M33] * matb[M31];
|
||||
tmp[M32] = mata[M30] * matb[M02] + mata[M31] * matb[M12] + mata[M32] * matb[M22] + mata[M33] * matb[M32];
|
||||
tmp[M33] = mata[M30] * matb[M03] + mata[M31] * matb[M13] + mata[M32] * matb[M23] + mata[M33] * matb[M33];
|
||||
tmp[M00] = mata[M00] * matb[M00] + mata[M01] * matb[M10] + mata[M02] * matb[M20]
|
||||
+ mata[M03] * matb[M30];
|
||||
tmp[M01] = mata[M00] * matb[M01] + mata[M01] * matb[M11] + mata[M02] * matb[M21]
|
||||
+ mata[M03] * matb[M31];
|
||||
tmp[M02] = mata[M00] * matb[M02] + mata[M01] * matb[M12] + mata[M02] * matb[M22]
|
||||
+ mata[M03] * matb[M32];
|
||||
tmp[M03] = mata[M00] * matb[M03] + mata[M01] * matb[M13] + mata[M02] * matb[M23]
|
||||
+ mata[M03] * matb[M33];
|
||||
tmp[M10] = mata[M10] * matb[M00] + mata[M11] * matb[M10] + mata[M12] * matb[M20]
|
||||
+ mata[M13] * matb[M30];
|
||||
tmp[M11] = mata[M10] * matb[M01] + mata[M11] * matb[M11] + mata[M12] * matb[M21]
|
||||
+ mata[M13] * matb[M31];
|
||||
tmp[M12] = mata[M10] * matb[M02] + mata[M11] * matb[M12] + mata[M12] * matb[M22]
|
||||
+ mata[M13] * matb[M32];
|
||||
tmp[M13] = mata[M10] * matb[M03] + mata[M11] * matb[M13] + mata[M12] * matb[M23]
|
||||
+ mata[M13] * matb[M33];
|
||||
tmp[M20] = mata[M20] * matb[M00] + mata[M21] * matb[M10] + mata[M22] * matb[M20]
|
||||
+ mata[M23] * matb[M30];
|
||||
tmp[M21] = mata[M20] * matb[M01] + mata[M21] * matb[M11] + mata[M22] * matb[M21]
|
||||
+ mata[M23] * matb[M31];
|
||||
tmp[M22] = mata[M20] * matb[M02] + mata[M21] * matb[M12] + mata[M22] * matb[M22]
|
||||
+ mata[M23] * matb[M32];
|
||||
tmp[M23] = mata[M20] * matb[M03] + mata[M21] * matb[M13] + mata[M22] * matb[M23]
|
||||
+ mata[M23] * matb[M33];
|
||||
tmp[M30] = mata[M30] * matb[M00] + mata[M31] * matb[M10] + mata[M32] * matb[M20]
|
||||
+ mata[M33] * matb[M30];
|
||||
tmp[M31] = mata[M30] * matb[M01] + mata[M31] * matb[M11] + mata[M32] * matb[M21]
|
||||
+ mata[M33] * matb[M31];
|
||||
tmp[M32] = mata[M30] * matb[M02] + mata[M31] * matb[M12] + mata[M32] * matb[M22]
|
||||
+ mata[M33] * matb[M32];
|
||||
tmp[M33] = mata[M30] * matb[M03] + mata[M31] * matb[M13] + mata[M32] * matb[M23]
|
||||
+ mata[M33] * matb[M33];
|
||||
System.arraycopy(tmp, 0, mata, 0, 16);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void finalize() {
|
||||
// if (pointer != 0)
|
||||
// delete(pointer);
|
||||
// }
|
||||
// @Override
|
||||
// public void finalize() {
|
||||
// if (pointer != 0)
|
||||
// delete(pointer);
|
||||
// }
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 The Android Open Source Project
|
||||
@ -335,6 +359,7 @@ public class GLMatrix {
|
||||
|
||||
/**
|
||||
* Define a projection matrix in terms of six clip planes
|
||||
*
|
||||
* @param m the float array that holds the perspective matrix
|
||||
* @param offset the offset into float array m where the perspective
|
||||
* matrix data is written
|
||||
@ -474,14 +499,14 @@ public class GLMatrix {
|
||||
- (btmp3 * src12 + btmp6 * src13 + btmp11 * src15);
|
||||
final float dst11 = (btmp5 * src12 + btmp8 * src13 + btmp11 * src14)
|
||||
- (btmp4 * src12 + btmp9 * src13 + btmp10 * src14);
|
||||
final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9 )
|
||||
final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9)
|
||||
- (btmp4 * src11 + btmp0 * src9 + btmp3 * src10);
|
||||
final float dst13 = (btmp8 * src11 + btmp0 * src8 + btmp7 * src10)
|
||||
- (btmp6 * src10 + btmp9 * src11 + btmp1 * src8 );
|
||||
final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8 )
|
||||
- (btmp10 * src11 + btmp2 * src8 + btmp7 * src9 );
|
||||
final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9 )
|
||||
- (btmp8 * src9 + btmp11 * src10 + btmp5 * src8 );
|
||||
- (btmp6 * src10 + btmp9 * src11 + btmp1 * src8);
|
||||
final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8)
|
||||
- (btmp10 * src11 + btmp2 * src8 + btmp7 * src9);
|
||||
final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9)
|
||||
- (btmp8 * src9 + btmp11 * src10 + btmp5 * src8);
|
||||
|
||||
// calculate determinant
|
||||
final float det =
|
||||
@ -493,18 +518,18 @@ public class GLMatrix {
|
||||
|
||||
// calculate matrix inverse
|
||||
final float invdet = 1.0f / det;
|
||||
mInv[ mInvOffset] = dst0 * invdet;
|
||||
mInv[ 1 + mInvOffset] = dst1 * invdet;
|
||||
mInv[ 2 + mInvOffset] = dst2 * invdet;
|
||||
mInv[ 3 + mInvOffset] = dst3 * invdet;
|
||||
mInv[mInvOffset] = dst0 * invdet;
|
||||
mInv[1 + mInvOffset] = dst1 * invdet;
|
||||
mInv[2 + mInvOffset] = dst2 * invdet;
|
||||
mInv[3 + mInvOffset] = dst3 * invdet;
|
||||
|
||||
mInv[ 4 + mInvOffset] = dst4 * invdet;
|
||||
mInv[ 5 + mInvOffset] = dst5 * invdet;
|
||||
mInv[ 6 + mInvOffset] = dst6 * invdet;
|
||||
mInv[ 7 + mInvOffset] = dst7 * invdet;
|
||||
mInv[4 + mInvOffset] = dst4 * invdet;
|
||||
mInv[5 + mInvOffset] = dst5 * invdet;
|
||||
mInv[6 + mInvOffset] = dst6 * invdet;
|
||||
mInv[7 + mInvOffset] = dst7 * invdet;
|
||||
|
||||
mInv[ 8 + mInvOffset] = dst8 * invdet;
|
||||
mInv[ 9 + mInvOffset] = dst9 * invdet;
|
||||
mInv[8 + mInvOffset] = dst8 * invdet;
|
||||
mInv[9 + mInvOffset] = dst9 * invdet;
|
||||
mInv[10 + mInvOffset] = dst10 * invdet;
|
||||
mInv[11 + mInvOffset] = dst11 * invdet;
|
||||
|
||||
|
@ -14,7 +14,7 @@ public class RenderThemeHandler2 {
|
||||
private final static int LINE_HIGHWAY = 2;
|
||||
private final static Tag TAG_WATER = new Tag("natural", "water");
|
||||
private final static Tag TAG_WOOD = new Tag("natural", "wood");
|
||||
private final static Tag TAG_FOREST= new Tag("landuse", "forest");
|
||||
private final static Tag TAG_FOREST = new Tag("landuse", "forest");
|
||||
|
||||
private static RenderInstruction[][] instructions = {
|
||||
// water
|
||||
@ -38,7 +38,7 @@ public class RenderThemeHandler2 {
|
||||
if (e.tags.contains(TAG_WATER))
|
||||
return instructions[AREA_WATER];
|
||||
|
||||
if (e.tags.contains(TAG_WOOD) ||e.tags.contains(TAG_FOREST))
|
||||
if (e.tags.contains(TAG_WOOD) || e.tags.contains(TAG_FOREST))
|
||||
return instructions[AREA_WOOD];
|
||||
|
||||
} else if (e.isLine()) {
|
||||
|
@ -54,6 +54,7 @@ public final class IOUtils {
|
||||
Log.d(IOUtils.class.getName(), e.getMessage() + " " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private IOUtils() {
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ public class Tessellator {
|
||||
|
||||
//JavaScriptObject o;
|
||||
Int32Array io;
|
||||
try{
|
||||
try {
|
||||
io = tessellate(JsArrayUtils.readOnlyJsArray(points), ppos, plen,
|
||||
JsArrayUtils.readOnlyJsArray(index), ipos, rings);
|
||||
} catch(JavaScriptException e){
|
||||
} catch (JavaScriptException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
@ -27,22 +27,22 @@ public class Tessellator {
|
||||
//Float32Array vo = getPoints(o);
|
||||
//Int32Array io = getIndices(o);
|
||||
|
||||
if (io == null){
|
||||
if (io == null) {
|
||||
Log.d("Triangulator", "building tessellation failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if (vo.length() != plen) {
|
||||
// // TODO handle different output points
|
||||
// Log.d("", "other points out" + plen + ":" + vo.length() + ", " + io.length());
|
||||
//
|
||||
// //for (int i = 0; i < vo.length(); i += 2)
|
||||
// // Log.d("<", vo.get(i) + " " + vo.get(i + 1));
|
||||
// //for (int i = ppos; i < ppos + plen; i += 2)
|
||||
// // Log.d(">", points[i]+ " " + points[i + 1]);
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
// if (vo.length() != plen) {
|
||||
// // TODO handle different output points
|
||||
// Log.d("", "other points out" + plen + ":" + vo.length() + ", " + io.length());
|
||||
//
|
||||
// //for (int i = 0; i < vo.length(); i += 2)
|
||||
// // Log.d("<", vo.get(i) + " " + vo.get(i + 1));
|
||||
// //for (int i = ppos; i < ppos + plen; i += 2)
|
||||
// // Log.d(">", points[i]+ " " + points[i + 1]);
|
||||
//
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
int numIndices = io.length();
|
||||
|
||||
@ -58,7 +58,7 @@ public class Tessellator {
|
||||
if (k + cnt > numIndices)
|
||||
cnt = numIndices - k;
|
||||
|
||||
for (int i = 0; i < cnt; i++){
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
int idx = (vertexOffset + io.get(k + i));
|
||||
outTris.vertices[outTris.used + i] = (short) idx;
|
||||
}
|
||||
@ -75,19 +75,19 @@ public class Tessellator {
|
||||
bOffset, bOffset + bLength);
|
||||
}-*/;
|
||||
|
||||
// static native JavaScriptObject tessellate(JsArrayNumber points, int pOffset, int pLength,
|
||||
// JsArrayInteger bounds, int bOffset, int bLength)/*-{
|
||||
//
|
||||
// return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds,
|
||||
// bOffset, bOffset + bLength);
|
||||
// }-*/;
|
||||
// static native JavaScriptObject tessellate(JsArrayNumber points, int pOffset, int pLength,
|
||||
// JsArrayInteger bounds, int bOffset, int bLength)/*-{
|
||||
//
|
||||
// return $wnd.tessellate(points, pOffset, pOffset + pLength, bounds,
|
||||
// bOffset, bOffset + bLength);
|
||||
// }-*/;
|
||||
|
||||
// static native Float32Array getPoints(JavaScriptObject result)/*-{
|
||||
// return result.vertices;
|
||||
// }-*/;
|
||||
// static native Float32Array getPoints(JavaScriptObject result)/*-{
|
||||
// return result.vertices;
|
||||
// }-*/;
|
||||
|
||||
// static native Int32Array getIndices(JavaScriptObject result)/*-{
|
||||
// return result.triangles;
|
||||
// }-*/;
|
||||
// static native Int32Array getIndices(JavaScriptObject result)/*-{
|
||||
// return result.triangles;
|
||||
// }-*/;
|
||||
|
||||
}
|
||||
|
@ -5,14 +5,16 @@ import com.badlogic.gdx.utils.Disposable;
|
||||
|
||||
/**
|
||||
* GWT emulation of AsynchExecutor, will call tasks immediately :D
|
||||
*
|
||||
* @author badlogic
|
||||
*
|
||||
*/
|
||||
public class AsyncExecutor implements Disposable {
|
||||
|
||||
/**
|
||||
* Creates a new AsynchExecutor that allows maxConcurrent
|
||||
* {@link Runnable} instances to run in parallel.
|
||||
* Creates a new AsynchExecutor that allows maxConcurrent {@link Runnable}
|
||||
* instances to run in parallel.
|
||||
*
|
||||
* @param maxConcurrent
|
||||
*/
|
||||
public AsyncExecutor(int maxConcurrent) {
|
||||
@ -23,6 +25,7 @@ public class AsyncExecutor implements Disposable {
|
||||
* Submits a {@link Runnable} to be executed asynchronously. If
|
||||
* maxConcurrent runnables are already running, the runnable
|
||||
* will be queued.
|
||||
*
|
||||
* @param task the task to execute asynchronously
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@ -33,7 +36,7 @@ public class AsyncExecutor implements Disposable {
|
||||
try {
|
||||
task.run();
|
||||
result = task.getResult();
|
||||
} catch(Throwable t) {
|
||||
} catch (Throwable t) {
|
||||
error = true;
|
||||
}
|
||||
if (error)
|
||||
@ -46,17 +49,19 @@ public class AsyncExecutor implements Disposable {
|
||||
* Submits a {@link Runnable} to be executed asynchronously. If
|
||||
* maxConcurrent runnables are already running, the runnable
|
||||
* will be queued.
|
||||
*
|
||||
* @param task the task to execute asynchronously
|
||||
*/
|
||||
public void post(Runnable task) {
|
||||
Gdx.app.postRunnable(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for running {@link AsyncTask} instances to finish,
|
||||
* then destroys any resources like threads. Can not be used
|
||||
* after this method is called.
|
||||
*/
|
||||
@Override
|
||||
public void dispose () {
|
||||
public void dispose() {
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ package org.oscim.utils.async;
|
||||
//import java.util.concurrent.ExecutionException;
|
||||
//import java.util.concurrent.Future;
|
||||
|
||||
|
||||
/**
|
||||
* Returned by {@link AsyncExecutor#submit(AsyncTask)}, allows to poll
|
||||
* for the result of the asynch workload.
|
||||
*
|
||||
* @author badlogic
|
||||
*
|
||||
*/
|
||||
@ -41,7 +41,8 @@ public class AsyncResult<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the result, or null if there was an error, no result, or the task is still running
|
||||
* @return the result, or null if there was an error, no result, or the task
|
||||
* is still running
|
||||
*/
|
||||
public T get() {
|
||||
return result;
|
||||
|
@ -16,13 +16,15 @@
|
||||
|
||||
package org.oscim.utils.async;
|
||||
|
||||
|
||||
/**
|
||||
* Task to be submitted to an {@link AsyncExecutor}, returning a result of type T.
|
||||
* Task to be submitted to an {@link AsyncExecutor}, returning a result of type
|
||||
* T.
|
||||
*
|
||||
* @author badlogic
|
||||
*
|
||||
*/
|
||||
public interface AsyncTask<T> extends Runnable{
|
||||
public interface AsyncTask<T> extends Runnable {
|
||||
public boolean cancel();
|
||||
|
||||
public T getResult() throws Exception;
|
||||
}
|
@ -18,6 +18,7 @@ package org.oscim.utils.async;
|
||||
|
||||
/**
|
||||
* GWT emulation of ThreadUtils, does nothing.
|
||||
*
|
||||
* @author badlogic
|
||||
*
|
||||
*/
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.xml.sax;
|
||||
|
||||
|
||||
public abstract interface Attributes {
|
||||
public abstract int getLength();
|
||||
|
||||
|
@ -12,6 +12,7 @@ public class SAXException extends IOException {
|
||||
public SAXException(String str) {
|
||||
super(str);
|
||||
}
|
||||
|
||||
public SAXException(String str, Throwable throwable)
|
||||
{
|
||||
super(str);
|
||||
|
@ -10,6 +10,7 @@ public class SAXParseException extends SAXException {
|
||||
public SAXParseException(String str) {
|
||||
super(str);
|
||||
}
|
||||
|
||||
public SAXParseException(String str, Throwable throwable)
|
||||
{
|
||||
super(str);
|
||||
|
@ -12,6 +12,7 @@ public class DefaultHandler {
|
||||
public void error(SAXParseException exception) {
|
||||
|
||||
}
|
||||
|
||||
public void warning(SAXParseException exception) {
|
||||
|
||||
}
|
||||
@ -25,5 +26,4 @@ public class DefaultHandler {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -123,17 +123,17 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
mMap.setTheme(InternalRenderTheme.DEFAULT);
|
||||
|
||||
if (buildings)
|
||||
mMap.getLayers().add(
|
||||
new BuildingLayer(mMap, mMapLayer.getTileLayer()));
|
||||
mMap.getLayers()
|
||||
.add(new BuildingLayer(mMap, mMapLayer.getTileLayer()));
|
||||
|
||||
if (labels)
|
||||
mMap.getLayers().add(new LabelLayer(mMap,
|
||||
mMapLayer.getTileLayer()));
|
||||
mMap.getLayers()
|
||||
.add(new LabelLayer(mMap, mMapLayer.getTileLayer()));
|
||||
}
|
||||
|
||||
if (tileGrid)
|
||||
mMap.getLayers().add(new GenericLayer(mMap,
|
||||
new GridRenderer()));
|
||||
mMap.getLayers()
|
||||
.add(new GenericLayer(mMap, new GridRenderer()));
|
||||
}
|
||||
|
||||
// Stage ui;
|
||||
@ -227,7 +227,6 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
public void resume() {
|
||||
}
|
||||
|
||||
|
||||
class TouchHandler implements InputProcessor {
|
||||
|
||||
private Viewport mMapPosition;
|
||||
@ -533,8 +532,7 @@ public abstract class GdxMap implements ApplicationListener {
|
||||
// decrease change of scale by the change of rotation
|
||||
// * 20 is just arbitrary
|
||||
if (mBeginRotate)
|
||||
scale = 1 + ((scale - 1) * Math.max(
|
||||
(1 - (float) Math.abs(r) * 20), 0));
|
||||
scale = 1 + ((scale - 1) * Math.max((1 - (float) Math.abs(r) * 20), 0));
|
||||
|
||||
mSumScale *= scale;
|
||||
|
||||
|
@ -4,7 +4,7 @@ import org.oscim.event.MotionEvent;
|
||||
|
||||
import com.badlogic.gdx.InputProcessor;
|
||||
|
||||
public class GdxMotionEvent extends MotionEvent implements InputProcessor{
|
||||
public class GdxMotionEvent extends MotionEvent implements InputProcessor {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -20,8 +20,11 @@ import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
/** Interface wrapping all the methods of OpenGL ES 2.0
|
||||
* @author mzechner */
|
||||
/**
|
||||
* Interface wrapping all the methods of OpenGL ES 2.0
|
||||
*
|
||||
* @author mzechner
|
||||
*/
|
||||
public interface GL20 {
|
||||
public static final int GL_ES_VERSION_2_0 = 1;
|
||||
public static final int GL_DEPTH_BUFFER_BIT = 0x00000100;
|
||||
@ -332,217 +335,222 @@ public interface GL20 {
|
||||
// Extensions
|
||||
public static final int GL_COVERAGE_BUFFER_BIT_NV = 0x8000;
|
||||
|
||||
public void glAttachShader (int program, int shader);
|
||||
public void glAttachShader(int program, int shader);
|
||||
|
||||
public void glBindAttribLocation (int program, int index, String name);
|
||||
public void glBindAttribLocation(int program, int index, String name);
|
||||
|
||||
public void glBindBuffer (int target, int buffer);
|
||||
public void glBindBuffer(int target, int buffer);
|
||||
|
||||
public void glBindFramebuffer (int target, int framebuffer);
|
||||
public void glBindFramebuffer(int target, int framebuffer);
|
||||
|
||||
public void glBindRenderbuffer (int target, int renderbuffer);
|
||||
public void glBindRenderbuffer(int target, int renderbuffer);
|
||||
|
||||
public void glBlendColor (float red, float green, float blue, float alpha);
|
||||
public void glBlendColor(float red, float green, float blue, float alpha);
|
||||
|
||||
public void glBlendEquation (int mode);
|
||||
public void glBlendEquation(int mode);
|
||||
|
||||
public void glBlendEquationSeparate (int modeRGB, int modeAlpha);
|
||||
public void glBlendEquationSeparate(int modeRGB, int modeAlpha);
|
||||
|
||||
public void glBlendFuncSeparate (int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
|
||||
public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
|
||||
|
||||
public void glBufferData (int target, int size, Buffer data, int usage);
|
||||
public void glBufferData(int target, int size, Buffer data, int usage);
|
||||
|
||||
public void glBufferSubData (int target, int offset, int size, Buffer data);
|
||||
public void glBufferSubData(int target, int offset, int size, Buffer data);
|
||||
|
||||
public int glCheckFramebufferStatus (int target);
|
||||
public int glCheckFramebufferStatus(int target);
|
||||
|
||||
public void glCompileShader (int shader);
|
||||
public void glCompileShader(int shader);
|
||||
|
||||
public int glCreateProgram ();
|
||||
public int glCreateProgram();
|
||||
|
||||
public int glCreateShader (int type);
|
||||
public int glCreateShader(int type);
|
||||
|
||||
public void glDeleteBuffers (int n, IntBuffer buffers);
|
||||
public void glDeleteBuffers(int n, IntBuffer buffers);
|
||||
|
||||
public void glDeleteFramebuffers (int n, IntBuffer framebuffers);
|
||||
public void glDeleteFramebuffers(int n, IntBuffer framebuffers);
|
||||
|
||||
public void glDeleteProgram (int program);
|
||||
public void glDeleteProgram(int program);
|
||||
|
||||
public void glDeleteRenderbuffers (int n, IntBuffer renderbuffers);
|
||||
public void glDeleteRenderbuffers(int n, IntBuffer renderbuffers);
|
||||
|
||||
public void glDeleteShader (int shader);
|
||||
public void glDeleteShader(int shader);
|
||||
|
||||
public void glDetachShader (int program, int shader);
|
||||
public void glDetachShader(int program, int shader);
|
||||
|
||||
public void glDisableVertexAttribArray (int index);
|
||||
public void glDisableVertexAttribArray(int index);
|
||||
|
||||
public void glDrawElements (int mode, int count, int type, int indices);
|
||||
public void glDrawElements(int mode, int count, int type, int indices);
|
||||
|
||||
public void glEnableVertexAttribArray (int index);
|
||||
public void glEnableVertexAttribArray(int index);
|
||||
|
||||
public void glFramebufferRenderbuffer (int target, int attachment, int renderbuffertarget, int renderbuffer);
|
||||
public void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget,
|
||||
int renderbuffer);
|
||||
|
||||
public void glFramebufferTexture2D (int target, int attachment, int textarget, int texture, int level);
|
||||
public void glFramebufferTexture2D(int target, int attachment, int textarget, int texture,
|
||||
int level);
|
||||
|
||||
public void glGenBuffers (int n, IntBuffer buffers);
|
||||
public void glGenBuffers(int n, IntBuffer buffers);
|
||||
|
||||
public void glGenerateMipmap (int target);
|
||||
public void glGenerateMipmap(int target);
|
||||
|
||||
public void glGenFramebuffers (int n, IntBuffer framebuffers);
|
||||
public void glGenFramebuffers(int n, IntBuffer framebuffers);
|
||||
|
||||
public void glGenRenderbuffers (int n, IntBuffer renderbuffers);
|
||||
public void glGenRenderbuffers(int n, IntBuffer renderbuffers);
|
||||
|
||||
// deviates
|
||||
public String glGetActiveAttrib (int program, int index, IntBuffer size, Buffer type);
|
||||
public String glGetActiveAttrib(int program, int index, IntBuffer size, Buffer type);
|
||||
|
||||
// deviates
|
||||
public String glGetActiveUniform (int program, int index, IntBuffer size, Buffer type);
|
||||
public String glGetActiveUniform(int program, int index, IntBuffer size, Buffer type);
|
||||
|
||||
public void glGetAttachedShaders (int program, int maxcount, Buffer count, IntBuffer shaders);
|
||||
public void glGetAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders);
|
||||
|
||||
public int glGetAttribLocation (int program, String name);
|
||||
public int glGetAttribLocation(int program, String name);
|
||||
|
||||
public void glGetBooleanv (int pname, Buffer params);
|
||||
public void glGetBooleanv(int pname, Buffer params);
|
||||
|
||||
public void glGetBufferParameteriv (int target, int pname, IntBuffer params);
|
||||
public void glGetBufferParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void glGetFloatv (int pname, FloatBuffer params);
|
||||
public void glGetFloatv(int pname, FloatBuffer params);
|
||||
|
||||
public void glGetFramebufferAttachmentParameteriv (int target, int attachment, int pname, IntBuffer params);
|
||||
public void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname,
|
||||
IntBuffer params);
|
||||
|
||||
public void glGetProgramiv (int program, int pname, IntBuffer params);
|
||||
public void glGetProgramiv(int program, int pname, IntBuffer params);
|
||||
|
||||
// deviates
|
||||
public String glGetProgramInfoLog (int program);
|
||||
public String glGetProgramInfoLog(int program);
|
||||
|
||||
public void glGetRenderbufferParameteriv (int target, int pname, IntBuffer params);
|
||||
public void glGetRenderbufferParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void glGetShaderiv (int shader, int pname, IntBuffer params);
|
||||
public void glGetShaderiv(int shader, int pname, IntBuffer params);
|
||||
|
||||
// deviates
|
||||
public String glGetShaderInfoLog (int shader);
|
||||
public String glGetShaderInfoLog(int shader);
|
||||
|
||||
public void glGetShaderPrecisionFormat (int shadertype, int precisiontype, IntBuffer range, IntBuffer precision);
|
||||
public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range,
|
||||
IntBuffer precision);
|
||||
|
||||
public void glGetShaderSource (int shader, int bufsize, Buffer length, String source);
|
||||
public void glGetShaderSource(int shader, int bufsize, Buffer length, String source);
|
||||
|
||||
public void glGetTexParameterfv (int target, int pname, FloatBuffer params);
|
||||
public void glGetTexParameterfv(int target, int pname, FloatBuffer params);
|
||||
|
||||
public void glGetTexParameteriv (int target, int pname, IntBuffer params);
|
||||
public void glGetTexParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void glGetUniformfv (int program, int location, FloatBuffer params);
|
||||
public void glGetUniformfv(int program, int location, FloatBuffer params);
|
||||
|
||||
public void glGetUniformiv (int program, int location, IntBuffer params);
|
||||
public void glGetUniformiv(int program, int location, IntBuffer params);
|
||||
|
||||
public int glGetUniformLocation (int program, String name);
|
||||
public int glGetUniformLocation(int program, String name);
|
||||
|
||||
public void glGetVertexAttribfv (int index, int pname, FloatBuffer params);
|
||||
public void glGetVertexAttribfv(int index, int pname, FloatBuffer params);
|
||||
|
||||
public void glGetVertexAttribiv (int index, int pname, IntBuffer params);
|
||||
public void glGetVertexAttribiv(int index, int pname, IntBuffer params);
|
||||
|
||||
public void glGetVertexAttribPointerv (int index, int pname, Buffer pointer);
|
||||
public void glGetVertexAttribPointerv(int index, int pname, Buffer pointer);
|
||||
|
||||
public boolean glIsBuffer (int buffer);
|
||||
public boolean glIsBuffer(int buffer);
|
||||
|
||||
public boolean glIsEnabled (int cap);
|
||||
public boolean glIsEnabled(int cap);
|
||||
|
||||
public boolean glIsFramebuffer (int framebuffer);
|
||||
public boolean glIsFramebuffer(int framebuffer);
|
||||
|
||||
public boolean glIsProgram (int program);
|
||||
public boolean glIsProgram(int program);
|
||||
|
||||
public boolean glIsRenderbuffer (int renderbuffer);
|
||||
public boolean glIsRenderbuffer(int renderbuffer);
|
||||
|
||||
public boolean glIsShader (int shader);
|
||||
public boolean glIsShader(int shader);
|
||||
|
||||
public boolean glIsTexture (int texture);
|
||||
public boolean glIsTexture(int texture);
|
||||
|
||||
public void glLinkProgram (int program);
|
||||
public void glLinkProgram(int program);
|
||||
|
||||
public void glReleaseShaderCompiler ();
|
||||
public void glReleaseShaderCompiler();
|
||||
|
||||
public void glRenderbufferStorage (int target, int internalformat, int width, int height);
|
||||
public void glRenderbufferStorage(int target, int internalformat, int width, int height);
|
||||
|
||||
public void glSampleCoverage (float value, boolean invert);
|
||||
public void glSampleCoverage(float value, boolean invert);
|
||||
|
||||
public void glShaderBinary (int n, IntBuffer shaders, int binaryformat, Buffer binary, int length);
|
||||
public void glShaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length);
|
||||
|
||||
// Deviates
|
||||
public void glShaderSource (int shader, String string);
|
||||
public void glShaderSource(int shader, String string);
|
||||
|
||||
public void glStencilFuncSeparate (int face, int func, int ref, int mask);
|
||||
public void glStencilFuncSeparate(int face, int func, int ref, int mask);
|
||||
|
||||
public void glStencilMaskSeparate (int face, int mask);
|
||||
public void glStencilMaskSeparate(int face, int mask);
|
||||
|
||||
public void glStencilOpSeparate (int face, int fail, int zfail, int zpass);
|
||||
public void glStencilOpSeparate(int face, int fail, int zfail, int zpass);
|
||||
|
||||
public void glTexParameterfv (int target, int pname, FloatBuffer params);
|
||||
public void glTexParameterfv(int target, int pname, FloatBuffer params);
|
||||
|
||||
public void glTexParameteri (int target, int pname, int param);
|
||||
public void glTexParameteri(int target, int pname, int param);
|
||||
|
||||
public void glTexParameteriv (int target, int pname, IntBuffer params);
|
||||
public void glTexParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void glUniform1f (int location, float x);
|
||||
public void glUniform1f(int location, float x);
|
||||
|
||||
public void glUniform1fv (int location, int count, FloatBuffer v);
|
||||
public void glUniform1fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void glUniform1i (int location, int x);
|
||||
public void glUniform1i(int location, int x);
|
||||
|
||||
public void glUniform1iv (int location, int count, IntBuffer v);
|
||||
public void glUniform1iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void glUniform2f (int location, float x, float y);
|
||||
public void glUniform2f(int location, float x, float y);
|
||||
|
||||
public void glUniform2fv (int location, int count, FloatBuffer v);
|
||||
public void glUniform2fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void glUniform2i (int location, int x, int y);
|
||||
public void glUniform2i(int location, int x, int y);
|
||||
|
||||
public void glUniform2iv (int location, int count, IntBuffer v);
|
||||
public void glUniform2iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void glUniform3f (int location, float x, float y, float z);
|
||||
public void glUniform3f(int location, float x, float y, float z);
|
||||
|
||||
public void glUniform3fv (int location, int count, FloatBuffer v);
|
||||
public void glUniform3fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void glUniform3i (int location, int x, int y, int z);
|
||||
public void glUniform3i(int location, int x, int y, int z);
|
||||
|
||||
public void glUniform3iv (int location, int count, IntBuffer v);
|
||||
public void glUniform3iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void glUniform4f (int location, float x, float y, float z, float w);
|
||||
public void glUniform4f(int location, float x, float y, float z, float w);
|
||||
|
||||
public void glUniform4fv (int location, int count, FloatBuffer v);
|
||||
public void glUniform4fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void glUniform4i (int location, int x, int y, int z, int w);
|
||||
public void glUniform4i(int location, int x, int y, int z, int w);
|
||||
|
||||
public void glUniform4iv (int location, int count, IntBuffer v);
|
||||
public void glUniform4iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void glUniformMatrix2fv (int location, int count, boolean transpose, FloatBuffer value);
|
||||
public void glUniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void glUniformMatrix3fv (int location, int count, boolean transpose, FloatBuffer value);
|
||||
public void glUniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void glUniformMatrix4fv (int location, int count, boolean transpose, FloatBuffer value);
|
||||
public void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void glUseProgram (int program);
|
||||
public void glUseProgram(int program);
|
||||
|
||||
public void glValidateProgram (int program);
|
||||
public void glValidateProgram(int program);
|
||||
|
||||
public void glVertexAttrib1f (int indx, float x);
|
||||
public void glVertexAttrib1f(int indx, float x);
|
||||
|
||||
public void glVertexAttrib1fv (int indx, FloatBuffer values);
|
||||
public void glVertexAttrib1fv(int indx, FloatBuffer values);
|
||||
|
||||
public void glVertexAttrib2f (int indx, float x, float y);
|
||||
public void glVertexAttrib2f(int indx, float x, float y);
|
||||
|
||||
public void glVertexAttrib2fv (int indx, FloatBuffer values);
|
||||
public void glVertexAttrib2fv(int indx, FloatBuffer values);
|
||||
|
||||
public void glVertexAttrib3f (int indx, float x, float y, float z);
|
||||
public void glVertexAttrib3f(int indx, float x, float y, float z);
|
||||
|
||||
public void glVertexAttrib3fv (int indx, FloatBuffer values);
|
||||
public void glVertexAttrib3fv(int indx, FloatBuffer values);
|
||||
|
||||
public void glVertexAttrib4f (int indx, float x, float y, float z, float w);
|
||||
public void glVertexAttrib4f(int indx, float x, float y, float z, float w);
|
||||
|
||||
public void glVertexAttrib4fv (int indx, FloatBuffer values);
|
||||
public void glVertexAttrib4fv(int indx, FloatBuffer values);
|
||||
|
||||
public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, Buffer ptr);
|
||||
|
||||
public void glVertexAttribPointer (int indx, int size, int type, boolean normalized, int stride, int ptr);
|
||||
public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
Buffer ptr);
|
||||
|
||||
public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
int ptr);
|
||||
|
||||
//------------------------
|
||||
|
||||
@ -550,89 +558,96 @@ public interface GL20 {
|
||||
public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
|
||||
public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
|
||||
public void glActiveTexture (int texture);
|
||||
public void glActiveTexture(int texture);
|
||||
|
||||
public void glBindTexture (int target, int texture);
|
||||
public void glBindTexture(int target, int texture);
|
||||
|
||||
public void glBlendFunc (int sfactor, int dfactor);
|
||||
public void glBlendFunc(int sfactor, int dfactor);
|
||||
|
||||
public void glClear (int mask);
|
||||
public void glClear(int mask);
|
||||
|
||||
public void glClearColor (float red, float green, float blue, float alpha);
|
||||
public void glClearColor(float red, float green, float blue, float alpha);
|
||||
|
||||
public void glClearDepthf (float depth);
|
||||
public void glClearDepthf(float depth);
|
||||
|
||||
public void glClearStencil (int s);
|
||||
public void glClearStencil(int s);
|
||||
|
||||
public void glColorMask (boolean red, boolean green, boolean blue, boolean alpha);
|
||||
public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha);
|
||||
|
||||
public void glCompressedTexImage2D (int target, int level, int internalformat, int width, int height, int border,
|
||||
public void glCompressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
int height, int border,
|
||||
int imageSize, Buffer data);
|
||||
|
||||
public void glCompressedTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format,
|
||||
public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format,
|
||||
int imageSize, Buffer data);
|
||||
|
||||
public void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border);
|
||||
public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y,
|
||||
int width, int height, int border);
|
||||
|
||||
public void glCopyTexSubImage2D (int target, int level, int xoffset, int yoffset, int x, int y, int width, int height);
|
||||
public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
public void glCullFace (int mode);
|
||||
public void glCullFace(int mode);
|
||||
|
||||
public void glDeleteTextures (int n, IntBuffer textures);
|
||||
public void glDeleteTextures(int n, IntBuffer textures);
|
||||
|
||||
public void glDepthFunc (int func);
|
||||
public void glDepthFunc(int func);
|
||||
|
||||
public void glDepthMask (boolean flag);
|
||||
public void glDepthMask(boolean flag);
|
||||
|
||||
public void glDepthRangef (float zNear, float zFar);
|
||||
public void glDepthRangef(float zNear, float zFar);
|
||||
|
||||
public void glDisable (int cap);
|
||||
public void glDisable(int cap);
|
||||
|
||||
public void glDrawArrays (int mode, int first, int count);
|
||||
public void glDrawArrays(int mode, int first, int count);
|
||||
|
||||
public void glDrawElements (int mode, int count, int type, Buffer indices);
|
||||
public void glDrawElements(int mode, int count, int type, Buffer indices);
|
||||
|
||||
public void glEnable (int cap);
|
||||
public void glEnable(int cap);
|
||||
|
||||
public void glFinish ();
|
||||
public void glFinish();
|
||||
|
||||
public void glFlush ();
|
||||
public void glFlush();
|
||||
|
||||
public void glFrontFace (int mode);
|
||||
public void glFrontFace(int mode);
|
||||
|
||||
public void glGenTextures (int n, IntBuffer textures);
|
||||
public void glGenTextures(int n, IntBuffer textures);
|
||||
|
||||
public int glGetError ();
|
||||
public int glGetError();
|
||||
|
||||
public void glGetIntegerv (int pname, IntBuffer params);
|
||||
public void glGetIntegerv(int pname, IntBuffer params);
|
||||
|
||||
public String glGetString (int name);
|
||||
public String glGetString(int name);
|
||||
|
||||
public void glHint (int target, int mode);
|
||||
public void glHint(int target, int mode);
|
||||
|
||||
public void glLineWidth (float width);
|
||||
public void glLineWidth(float width);
|
||||
|
||||
public void glPixelStorei (int pname, int param);
|
||||
public void glPixelStorei(int pname, int param);
|
||||
|
||||
public void glPolygonOffset (float factor, float units);
|
||||
public void glPolygonOffset(float factor, float units);
|
||||
|
||||
public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels);
|
||||
|
||||
public void glScissor (int x, int y, int width, int height);
|
||||
|
||||
public void glStencilFunc (int func, int ref, int mask);
|
||||
|
||||
public void glStencilMask (int mask);
|
||||
|
||||
public void glStencilOp (int fail, int zfail, int zpass);
|
||||
|
||||
public void glTexImage2D (int target, int level, int internalformat, int width, int height, int border, int format, int type,
|
||||
public void glReadPixels(int x, int y, int width, int height, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void glTexParameterf (int target, int pname, float param);
|
||||
public void glScissor(int x, int y, int width, int height);
|
||||
|
||||
public void glTexSubImage2D (int target, int level, int xoffset, int yoffset, int width, int height, int format, int type,
|
||||
public void glStencilFunc(int func, int ref, int mask);
|
||||
|
||||
public void glStencilMask(int mask);
|
||||
|
||||
public void glStencilOp(int fail, int zfail, int zpass);
|
||||
|
||||
public void glTexImage2D(int target, int level, int internalformat, int width, int height,
|
||||
int border, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void glViewport (int x, int y, int width, int height);
|
||||
public void glTexParameterf(int target, int pname, float param);
|
||||
|
||||
public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width,
|
||||
int height, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void glViewport(int x, int y, int width, int height);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class Color {
|
||||
public static final int MAGENTA = 0xFFFF00FF;
|
||||
public static final int TRANSPARENT = 0;
|
||||
|
||||
public static int get(int r, int g ,int b){
|
||||
public static int get(int r, int g, int b) {
|
||||
return 0xff << 24 | r << 16 | g << 8 | b;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ public class Color {
|
||||
} else if (colorString.length() != 9) {
|
||||
throw new IllegalArgumentException("Unknown color");
|
||||
}
|
||||
return (int)color;
|
||||
return (int) color;
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown color");
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class MapPosition {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public void setPosition(GeoPoint geoPoint){
|
||||
public void setPosition(GeoPoint geoPoint) {
|
||||
setPosition(geoPoint.getLatitude(), geoPoint.getLongitude());
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,8 @@ public final class MercatorProjection {
|
||||
out[pos * 2] = ((p.longitudeE6 / 1E6) + 180.0) / 360.0;
|
||||
|
||||
double sinLatitude = Math.sin((p.latitudeE6 / 1E6) * (Math.PI / 180.0));
|
||||
out[pos * 2 +1] = 0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude)) / (4.0 * Math.PI);
|
||||
out[pos * 2 + 1] = 0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude))
|
||||
/ (4.0 * Math.PI);
|
||||
}
|
||||
|
||||
public static void project(double latitude, double longitude, double[] out, int pos) {
|
||||
@ -116,7 +117,8 @@ public final class MercatorProjection {
|
||||
out[pos * 2] = (longitude + 180.0) / 360.0;
|
||||
|
||||
double sinLatitude = Math.sin(latitude * (Math.PI / 180.0));
|
||||
out[pos * 2 +1] = 0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude)) / (4.0 * Math.PI);
|
||||
out[pos * 2 + 1] = 0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude))
|
||||
/ (4.0 * Math.PI);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,21 +17,25 @@ package org.oscim.core;
|
||||
public class Point {
|
||||
public double x;
|
||||
public double y;
|
||||
|
||||
public Point() {
|
||||
}
|
||||
public Point(double x, double y){
|
||||
|
||||
public Point(double x, double y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
public double getX(){
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
public double getY(){
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
public String toString() {
|
||||
return x + " " + y;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ package org.oscim.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
public class TagSet {
|
||||
public static TagSet EMPTY_TAG_SET = new TagSet();
|
||||
|
||||
@ -37,6 +36,7 @@ public class TagSet {
|
||||
|
||||
/**
|
||||
* null out current tags
|
||||
*
|
||||
* @param nulltags ...
|
||||
*/
|
||||
public void clear(boolean nulltags) {
|
||||
@ -44,7 +44,7 @@ public class TagSet {
|
||||
numTags = 0;
|
||||
}
|
||||
|
||||
public Tag[] asArray(){
|
||||
public Tag[] asArray() {
|
||||
Tag[] result = new Tag[numTags];
|
||||
System.arraycopy(tags, 0, result, 0, numTags);
|
||||
return result;
|
||||
@ -58,7 +58,8 @@ public class TagSet {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public boolean containsKey(String key){
|
||||
|
||||
public boolean containsKey(String key) {
|
||||
for (int i = 0; i < numTags; i++) {
|
||||
if (tags[i].key == key)
|
||||
return true;
|
||||
@ -66,7 +67,7 @@ public class TagSet {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getValue(String key){
|
||||
public String getValue(String key) {
|
||||
for (int i = 0; i < numTags; i++) {
|
||||
if (tags[i].key == key)
|
||||
return tags[i].value;
|
||||
@ -74,7 +75,7 @@ public class TagSet {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean contains(String key, String value){
|
||||
public boolean contains(String key, String value) {
|
||||
for (int i = 0; i < numTags; i++) {
|
||||
if (tags[i].key == key)
|
||||
return value.equals(tags[i].value);
|
||||
@ -91,7 +92,7 @@ public class TagSet {
|
||||
tags[numTags++] = tag;
|
||||
}
|
||||
|
||||
public void set(Tag[] tagArray){
|
||||
public void set(Tag[] tagArray) {
|
||||
int newTags = tagArray.length;
|
||||
if (newTags > tags.length)
|
||||
tags = new Tag[tagArray.length];
|
||||
@ -147,7 +148,7 @@ public class TagSet {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String asString(){
|
||||
public String asString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < numTags; i++)
|
||||
sb.append(tags[i]);
|
||||
|
@ -3,5 +3,6 @@ package org.oscim.event;
|
||||
public interface EventDispatcher {
|
||||
|
||||
public void addListener(String type, EventListener listener);
|
||||
|
||||
public void removeListener(String type, EventListener listener);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
package org.oscim.event;
|
||||
|
||||
public class KeyEvent extends MapEvent{
|
||||
public class KeyEvent extends MapEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -6,7 +6,6 @@ public class MapEvent extends EventObject {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public MapEvent(Object source) {
|
||||
super(source);
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
*/
|
||||
package org.oscim.event;
|
||||
|
||||
|
||||
public abstract class MotionEvent extends MapEvent {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -4,6 +4,8 @@ import org.oscim.core.MapPosition;
|
||||
|
||||
public interface TouchListener {
|
||||
boolean onPress(MotionEvent e, MapPosition pos);
|
||||
|
||||
boolean onLongPress(MotionEvent e, MapPosition pos);
|
||||
|
||||
boolean onTap(MotionEvent e, MapPosition pos);
|
||||
}
|
||||
|
@ -3,16 +3,16 @@ package org.oscim.layers;
|
||||
import org.oscim.backend.Log;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.map.Map.UpdateListener;
|
||||
import org.oscim.renderer.LayerRenderer;
|
||||
import org.oscim.renderer.MapRenderer.Matrices;
|
||||
|
||||
public class CustomRenderLayer extends Layer {
|
||||
public class CustomRenderLayer extends Layer implements UpdateListener {
|
||||
|
||||
private static final String TAG = CustomRenderLayer.class.getName();
|
||||
|
||||
class CustomRenderer extends LayerRenderer {
|
||||
|
||||
|
||||
// functions running on MapRender Thread
|
||||
@Override
|
||||
protected void update(MapPosition pos, boolean changed, Matrices matrices) {
|
||||
@ -33,7 +33,6 @@ public class CustomRenderLayer extends Layer {
|
||||
@Override
|
||||
protected void render(MapPosition pos, Matrices m) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CustomRenderLayer(Map map, LayerRenderer renderer) {
|
||||
@ -44,14 +43,11 @@ public class CustomRenderLayer extends Layer {
|
||||
|
||||
private int someConccurentVariable;
|
||||
|
||||
// @Override
|
||||
// public void onUpdate(MapPosition mapPosition, boolean changed, boolean clear) {
|
||||
//
|
||||
// synchronized (mRenderer) {
|
||||
// // chang
|
||||
// someConccurentVariable++;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
@Override
|
||||
public void onMapUpdate(MapPosition mapPosition, boolean changed, boolean clear) {
|
||||
|
||||
synchronized (mRenderer) {
|
||||
someConccurentVariable++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,10 +78,11 @@ public class MapEventLayer extends Layer implements EventListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEvent(MapEvent event){
|
||||
public void handleEvent(MapEvent event) {
|
||||
if (event instanceof MotionEvent)
|
||||
onTouchEvent((MotionEvent)event);
|
||||
onTouchEvent((MotionEvent) event);
|
||||
}
|
||||
|
||||
//private long mPrevTime;
|
||||
|
||||
private boolean mEnableRotation = true;
|
||||
@ -312,8 +313,7 @@ public class MapEventLayer extends Layer implements EventListener {
|
||||
int w = Tile.SIZE * 3;
|
||||
int h = Tile.SIZE * 3;
|
||||
|
||||
mMap.getAnimator().animateFling(
|
||||
Math.round(velocityX),
|
||||
mMap.getAnimator().animateFling(Math.round(velocityX),
|
||||
Math.round(velocityY),
|
||||
-w, w, -h, h);
|
||||
return true;
|
||||
|
@ -295,7 +295,8 @@ public class PathLayer extends Layer {
|
||||
* Math.pow(Math.sin((lon1 - lon2) / 2), 2)));
|
||||
double bearing = Math.atan2(
|
||||
Math.sin(lon1 - lon2) * Math.cos(lat2),
|
||||
Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2)
|
||||
Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1)
|
||||
* Math.cos(lat2)
|
||||
* Math.cos(lon1 - lon2))
|
||||
/ -(Math.PI / 180);
|
||||
bearing = bearing < 0 ? 360 + bearing : bearing;
|
||||
|
@ -157,6 +157,7 @@ public class ItemizedIconLayer<Item extends MarkerItem> extends ItemizedLayer<It
|
||||
* When a content sensitive action is performed the content item needs to be
|
||||
* identified. This method does that and then performs the assigned task on
|
||||
* that item.
|
||||
*
|
||||
* @param event
|
||||
* ...
|
||||
* @param task
|
||||
@ -218,6 +219,7 @@ public class ItemizedIconLayer<Item extends MarkerItem> extends ItemizedLayer<It
|
||||
* When the item is touched one of these methods may be invoked depending on
|
||||
* the type of touch. Each of them returns true if the event was completely
|
||||
* handled.
|
||||
*
|
||||
* @param <T>
|
||||
* ....
|
||||
*/
|
||||
|
@ -20,8 +20,10 @@ import java.net.URL;
|
||||
import org.oscim.core.Tile;
|
||||
//http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/5/14/14
|
||||
//http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer
|
||||
|
||||
public class ArcGISWorldShaded extends AbstractTileSource {
|
||||
public static final ArcGISWorldShaded INSTANCE = new ArcGISWorldShaded("server.arcgisonline.com", 80);
|
||||
public static final ArcGISWorldShaded INSTANCE = new ArcGISWorldShaded("server.arcgisonline.com",
|
||||
80);
|
||||
private static final int PARALLEL_REQUESTS_LIMIT = 4;
|
||||
private static final String PROTOCOL = "http";
|
||||
private static final int ZOOM_LEVEL_MAX = 6;
|
||||
|
@ -34,7 +34,6 @@ import org.oscim.tiling.TileLoader;
|
||||
import org.oscim.tiling.TileManager;
|
||||
import org.oscim.utils.FastMath;
|
||||
|
||||
|
||||
public class BitmapTileLayer extends TileLayer<TileLoader> {
|
||||
private static final int TIMEOUT_CONNECT = 5000;
|
||||
private static final int TIMEOUT_READ = 10000;
|
||||
@ -50,7 +49,6 @@ public class BitmapTileLayer extends TileLayer<TileLoader> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onMapUpdate(MapPosition pos, boolean changed, boolean clear) {
|
||||
super.onMapUpdate(pos, changed, clear);
|
||||
@ -70,7 +68,7 @@ public class BitmapTileLayer extends TileLayer<TileLoader> {
|
||||
break;
|
||||
}
|
||||
double range = f.scaleEnd / f.scaleStart;
|
||||
float a = (float)((range - (pos.scale / f.scaleStart)) / range);
|
||||
float a = (float) ((range - (pos.scale / f.scaleStart)) / range);
|
||||
a = FastMath.clamp(a, 0, 1);
|
||||
// interpolate alpha between start and end
|
||||
alpha = a * f.alphaStart + (1 - a) * f.alphaEnd;
|
||||
|
@ -21,7 +21,8 @@ import org.oscim.core.Tile;
|
||||
|
||||
public interface TileSource {
|
||||
/**
|
||||
* @return the maximum number of parallel requests which this {@code TileSource} supports.
|
||||
* @return the maximum number of parallel requests which this
|
||||
* {@code TileSource} supports.
|
||||
*/
|
||||
int getParallelRequestsLimit();
|
||||
|
||||
@ -42,7 +43,7 @@ public interface TileSource {
|
||||
|
||||
FadeStep[] getFadeSteps();
|
||||
|
||||
public class FadeStep{
|
||||
public class FadeStep {
|
||||
public final double scaleStart, scaleEnd;
|
||||
public final float alphaStart, alphaEnd;
|
||||
|
||||
|
@ -52,8 +52,7 @@ class Label extends TextItem {
|
||||
this.y2 = y + text.fontHeight / 2;
|
||||
}
|
||||
|
||||
static int comparePriority(Label l1, Label l2){
|
||||
|
||||
static int comparePriority(Label l1, Label l2) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -525,7 +525,7 @@ class TextRenderer extends ElementRenderer {
|
||||
}
|
||||
|
||||
for (Label ti = mLabels; ti != null; ti = (Label) ti.next) {
|
||||
if (ti.text.caption){
|
||||
if (ti.text.caption) {
|
||||
if (ti.text.texture != null) {
|
||||
SymbolItem s = SymbolItem.pool.get();
|
||||
s.texRegion = ti.text.texture;
|
||||
|
@ -128,6 +128,7 @@ public abstract class Map implements EventDispatcher {
|
||||
* Request call to onUpdate for all layers. This function can
|
||||
* be called from any thread. Request will be handled on main
|
||||
* thread.
|
||||
*
|
||||
* @param forceRedraw pass true to render next frame
|
||||
*/
|
||||
public abstract void updateMap(boolean forceRedraw);
|
||||
@ -192,6 +193,7 @@ public abstract class Map implements EventDispatcher {
|
||||
|
||||
/**
|
||||
* Get current {@link MapPosition}.
|
||||
*
|
||||
* @param mapPosition
|
||||
*/
|
||||
public boolean getMapPosition(MapPosition mapPosition) {
|
||||
|
@ -195,7 +195,6 @@ public final class BufferObject {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static synchronized void clear() {
|
||||
mBufferMemoryUsage = 0;
|
||||
|
||||
|
@ -228,6 +228,7 @@ public class GLMatrix {
|
||||
|
||||
/**
|
||||
* Define a projection matrix in terms of six clip planes
|
||||
*
|
||||
* @param m the float array that holds the perspective matrix
|
||||
* @param offset the offset into float array m where the perspective
|
||||
* matrix data is written
|
||||
@ -367,14 +368,14 @@ public class GLMatrix {
|
||||
- (btmp3 * src12 + btmp6 * src13 + btmp11 * src15);
|
||||
final float dst11 = (btmp5 * src12 + btmp8 * src13 + btmp11 * src14)
|
||||
- (btmp4 * src12 + btmp9 * src13 + btmp10 * src14);
|
||||
final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9 )
|
||||
final float dst12 = (btmp2 * src10 + btmp5 * src11 + btmp1 * src9)
|
||||
- (btmp4 * src11 + btmp0 * src9 + btmp3 * src10);
|
||||
final float dst13 = (btmp8 * src11 + btmp0 * src8 + btmp7 * src10)
|
||||
- (btmp6 * src10 + btmp9 * src11 + btmp1 * src8 );
|
||||
final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8 )
|
||||
- (btmp10 * src11 + btmp2 * src8 + btmp7 * src9 );
|
||||
final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9 )
|
||||
- (btmp8 * src9 + btmp11 * src10 + btmp5 * src8 );
|
||||
- (btmp6 * src10 + btmp9 * src11 + btmp1 * src8);
|
||||
final float dst14 = (btmp6 * src9 + btmp11 * src11 + btmp3 * src8)
|
||||
- (btmp10 * src11 + btmp2 * src8 + btmp7 * src9);
|
||||
final float dst15 = (btmp10 * src10 + btmp4 * src8 + btmp9 * src9)
|
||||
- (btmp8 * src9 + btmp11 * src10 + btmp5 * src8);
|
||||
|
||||
// calculate determinant
|
||||
final float det =
|
||||
@ -386,18 +387,18 @@ public class GLMatrix {
|
||||
|
||||
// calculate matrix inverse
|
||||
final float invdet = 1.0f / det;
|
||||
mInv[ mInvOffset] = dst0 * invdet;
|
||||
mInv[ 1 + mInvOffset] = dst1 * invdet;
|
||||
mInv[ 2 + mInvOffset] = dst2 * invdet;
|
||||
mInv[ 3 + mInvOffset] = dst3 * invdet;
|
||||
mInv[mInvOffset] = dst0 * invdet;
|
||||
mInv[1 + mInvOffset] = dst1 * invdet;
|
||||
mInv[2 + mInvOffset] = dst2 * invdet;
|
||||
mInv[3 + mInvOffset] = dst3 * invdet;
|
||||
|
||||
mInv[ 4 + mInvOffset] = dst4 * invdet;
|
||||
mInv[ 5 + mInvOffset] = dst5 * invdet;
|
||||
mInv[ 6 + mInvOffset] = dst6 * invdet;
|
||||
mInv[ 7 + mInvOffset] = dst7 * invdet;
|
||||
mInv[4 + mInvOffset] = dst4 * invdet;
|
||||
mInv[5 + mInvOffset] = dst5 * invdet;
|
||||
mInv[6 + mInvOffset] = dst6 * invdet;
|
||||
mInv[7 + mInvOffset] = dst7 * invdet;
|
||||
|
||||
mInv[ 8 + mInvOffset] = dst8 * invdet;
|
||||
mInv[ 9 + mInvOffset] = dst9 * invdet;
|
||||
mInv[8 + mInvOffset] = dst8 * invdet;
|
||||
mInv[9 + mInvOffset] = dst9 * invdet;
|
||||
mInv[10 + mInvOffset] = dst10 * invdet;
|
||||
mInv[11 + mInvOffset] = dst11 * invdet;
|
||||
|
||||
|
@ -42,10 +42,10 @@ public class GLState {
|
||||
GL.glDisable(GL20.GL_STENCIL_TEST);
|
||||
GL.glDisable(GL20.GL_DEPTH_TEST);
|
||||
|
||||
// if (currentTexId != 0) {
|
||||
// GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
// currentTexId = 0;
|
||||
// }
|
||||
// if (currentTexId != 0) {
|
||||
// GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
// currentTexId = 0;
|
||||
// }
|
||||
}
|
||||
|
||||
public static boolean useProgram(int shaderProgram) {
|
||||
@ -120,11 +120,11 @@ public class GLState {
|
||||
}
|
||||
|
||||
public static void bindTex2D(int id) {
|
||||
// if (GLAdapter.GDX_DESKTOP_QUIRKS){
|
||||
// GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
// if (GLAdapter.GDX_DESKTOP_QUIRKS){
|
||||
// GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
//if (GLAdapter.GDX_DESKTOP_QUIRKS && id != 0)
|
||||
// GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
// } else
|
||||
// } else
|
||||
|
||||
if (currentTexId != id) {
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, id);
|
||||
|
@ -32,7 +32,7 @@ public class GLUtils {
|
||||
|
||||
private static GL20 GL;
|
||||
|
||||
static void init(GL20 gl){
|
||||
static void init(GL20 gl) {
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
@ -62,11 +62,13 @@ public class GLUtils {
|
||||
public static void setColorBlend(int location, int color1, int color2, float mix) {
|
||||
float a1 = (((color1 >>> 24) & 0xff) / 255f) * (1 - mix);
|
||||
float a2 = (((color2 >>> 24) & 0xff) / 255f) * mix;
|
||||
GL.glUniform4f
|
||||
(location,
|
||||
((((color1 >>> 16) & 0xff) / 255f) * a1 + (((color2 >>> 16) & 0xff) / 255f) * a2),
|
||||
((((color1 >>> 8) & 0xff) / 255f) * a1 + (((color2 >>> 8) & 0xff) / 255f) * a2),
|
||||
((((color1 >>> 0) & 0xff) / 255f) * a1 + (((color2 >>> 0) & 0xff) / 255f) * a2),
|
||||
GL.glUniform4f(location,
|
||||
((((color1 >>> 16) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 16) & 0xff) / 255f) * a2),
|
||||
((((color1 >>> 8) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 8) & 0xff) / 255f) * a2),
|
||||
((((color1 >>> 0) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 0) & 0xff) / 255f) * a2),
|
||||
(a1 + a2));
|
||||
}
|
||||
|
||||
@ -133,7 +135,8 @@ public class GLUtils {
|
||||
return loadTexture(pixel, sum, 1, GL20.GL_ALPHA,
|
||||
GL20.GL_LINEAR, GL20.GL_LINEAR,
|
||||
// GLES20.GL_NEAREST, GLES20.GL_NEAREST,
|
||||
GL20.GL_REPEAT, GL20.GL_REPEAT);
|
||||
GL20.GL_REPEAT,
|
||||
GL20.GL_REPEAT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -318,7 +318,7 @@ public class MapRenderer {
|
||||
for (int i = 0, n = layers.length; i < n; i++) {
|
||||
LayerRenderer renderer = layers[i];
|
||||
|
||||
if (!renderer.isInitialized){
|
||||
if (!renderer.isInitialized) {
|
||||
renderer.setup();
|
||||
renderer.isInitialized = true;
|
||||
}
|
||||
|
@ -20,12 +20,9 @@ import org.oscim.renderer.atlas.TextureAtlas.Rect;
|
||||
import org.oscim.renderer.elements.TextureItem;
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
|
||||
|
||||
|
||||
|
||||
public abstract class SpriteManager<T> {
|
||||
|
||||
public class Sprite extends Inlist<Sprite>{
|
||||
public class Sprite extends Inlist<Sprite> {
|
||||
|
||||
public Sprite(T i, TextureAtlas a, Rect r) {
|
||||
atlas = a;
|
||||
@ -68,7 +65,7 @@ public abstract class SpriteManager<T> {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
public void clear() {
|
||||
TextureItem.releaseAll(mTexture);
|
||||
mAtlas.clear();
|
||||
items = null;
|
||||
@ -78,7 +75,7 @@ public abstract class SpriteManager<T> {
|
||||
mCanvas.setBitmap(mTexture.bitmap);
|
||||
}
|
||||
|
||||
public TextureItem getTextures(){
|
||||
public TextureItem getTextures() {
|
||||
return mTexture;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,6 @@ import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.renderer.elements.TextureItem;
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
|
||||
|
||||
public class TextureAtlas extends Inlist<TextureAtlas> {
|
||||
private final static String TAG = TextureAtlas.class.getName();
|
||||
|
||||
@ -86,7 +85,6 @@ public class TextureAtlas extends Inlist<TextureAtlas> {
|
||||
/** Allocated surface size */
|
||||
int mUsed;
|
||||
|
||||
|
||||
public TextureItem texture;
|
||||
|
||||
/**
|
||||
|
@ -506,7 +506,8 @@ public final class LineTexLayer extends RenderElement {
|
||||
+ " gl_FragColor = line_w * mix(u_bgcolor, u_color, min(stipple_w, stipple_p));"
|
||||
+ " } "; //*/
|
||||
|
||||
/* final static String fragmentShader = ""
|
||||
/*
|
||||
* final static String fragmentShader = ""
|
||||
* + "#extension GL_OES_standard_derivatives : enable\n"
|
||||
* + " precision mediump float;"
|
||||
* + " uniform sampler2D tex;"
|
||||
@ -527,8 +528,10 @@ public final class LineTexLayer extends RenderElement {
|
||||
* + " gl_FragColor = u_bgcolor * stipple_p;"
|
||||
* // +
|
||||
* " gl_FragColor = line_w * mix(u_bgcolor, u_color, min(stipple_w, stipple_p));"
|
||||
* + "}"; // */
|
||||
/* final static String fragmentShader = ""
|
||||
* + "}"; //
|
||||
*/
|
||||
/*
|
||||
* final static String fragmentShader = ""
|
||||
* + "#extension GL_OES_standard_derivatives : enable\n"
|
||||
* + " precision mediump float;"
|
||||
* + " uniform sampler2D tex;"
|
||||
@ -547,7 +550,8 @@ public final class LineTexLayer extends RenderElement {
|
||||
* + " float stipple_p = smoothstep(0.495, 0.505, dist);"
|
||||
* +
|
||||
* " gl_FragColor = line_w * mix(u_bgcolor, u_color, min(stipple_w, stipple_p));"
|
||||
* + " } "; // */
|
||||
* + " } "; //
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,8 @@ import org.oscim.backend.Log;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.Tile;
|
||||
|
||||
|
||||
public class MeshLayer extends RenderElement {
|
||||
GeometryBuffer mGeom = new GeometryBuffer(10,10);
|
||||
GeometryBuffer mGeom = new GeometryBuffer(10, 10);
|
||||
|
||||
public MeshLayer() {
|
||||
GeometryBuffer e = mGeom;
|
||||
@ -58,18 +57,18 @@ public class MeshLayer extends RenderElement {
|
||||
addMesh(e);
|
||||
}
|
||||
|
||||
public void addMesh(GeometryBuffer geom){
|
||||
public void addMesh(GeometryBuffer geom) {
|
||||
int numRings = 2;
|
||||
|
||||
long ctx = tessellate(geom.points, 0, geom.index, 0, numRings);
|
||||
|
||||
short[] coordinates = new short[100];
|
||||
|
||||
while (tessGetCoordinates(ctx, coordinates, 2) > 0){
|
||||
while (tessGetCoordinates(ctx, coordinates, 2) > 0) {
|
||||
Log.d("..", Arrays.toString(coordinates));
|
||||
}
|
||||
|
||||
while (tessGetIndices(ctx, coordinates) > 0){
|
||||
while (tessGetIndices(ctx, coordinates) > 0) {
|
||||
Log.d("..", Arrays.toString(coordinates));
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public final class PolygonLayer extends RenderElement {
|
||||
vertexItems = curItem;
|
||||
}
|
||||
|
||||
public void addPolygon(GeometryBuffer geom){
|
||||
public void addPolygon(GeometryBuffer geom) {
|
||||
addPolygon(geom.points, geom.index);
|
||||
}
|
||||
|
||||
@ -465,7 +465,9 @@ public final class PolygonLayer extends RenderElement {
|
||||
static void debugDraw(GLMatrix m, float[] coords, int color) {
|
||||
GLState.test(false, false);
|
||||
if (mDebugFill == null) {
|
||||
mDebugFill = ByteBuffer.allocateDirect(32).order(ByteOrder.nativeOrder())
|
||||
mDebugFill = ByteBuffer
|
||||
.allocateDirect(32)
|
||||
.order(ByteOrder.nativeOrder())
|
||||
.asFloatBuffer();
|
||||
mDebugFill.put(coords);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
|
||||
public abstract class RenderElement extends Inlist<RenderElement>{
|
||||
public abstract class RenderElement extends Inlist<RenderElement> {
|
||||
public final static byte LINE = 0;
|
||||
public final static byte POLYGON = 1;
|
||||
public final static byte TEXLINE = 2;
|
||||
@ -44,5 +44,6 @@ public abstract class RenderElement extends Inlist<RenderElement>{
|
||||
protected VertexItem curItem;
|
||||
|
||||
abstract protected void compile(ShortBuffer sbuf);
|
||||
|
||||
abstract protected void clear();
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.renderer.atlas.TextureAtlas;
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
|
||||
|
||||
public final class SymbolLayer extends TextureLayer {
|
||||
private final static String TAG = SymbolLayer.class.getName();
|
||||
|
||||
@ -129,8 +128,8 @@ public final class SymbolLayer extends TextureLayer {
|
||||
y1 = (short) (SCALE * (hh));
|
||||
y2 = (short) (SCALE * (-hh));
|
||||
} else {
|
||||
float hw = (float)(it.offset.x * width);
|
||||
float hh = (float)(it.offset.y * height);
|
||||
float hw = (float) (it.offset.x * width);
|
||||
float hh = (float) (it.offset.y * height);
|
||||
x1 = (short) (SCALE * (-hw));
|
||||
x2 = (short) (SCALE * (width - hw));
|
||||
y1 = (short) (SCALE * (height - hh));
|
||||
|
@ -55,14 +55,14 @@ public class TextItem extends Inlist<TextItem> {
|
||||
return ti;
|
||||
}
|
||||
|
||||
public static boolean shareText(TextItem ti1, TextItem ti2){
|
||||
public static boolean shareText(TextItem ti1, TextItem ti2) {
|
||||
if (ti1.text != ti2.text)
|
||||
return false;
|
||||
|
||||
if (ti1.string == ti2.string)
|
||||
return true;
|
||||
|
||||
if (ti1.string.equals(ti2.string)){
|
||||
if (ti1.string.equals(ti2.string)) {
|
||||
// make strings unique, should be done only once..
|
||||
ti1.string = ti2.string;
|
||||
return true;
|
||||
|
@ -36,12 +36,13 @@ public class VertexItem extends Inlist<VertexItem> {
|
||||
};
|
||||
|
||||
/**
|
||||
* Add VertexItems back to pool. Make sure to not use the reference afterwards!
|
||||
* Add VertexItems back to pool. Make sure to not use the reference
|
||||
* afterwards!
|
||||
* i.e.:
|
||||
* vertexItem.release();
|
||||
* vertexItem = null;
|
||||
* */
|
||||
public void release(){
|
||||
public void release() {
|
||||
VertexItem.pool.releaseAll(this);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ import org.oscim.renderer.GLUtils;
|
||||
import org.oscim.renderer.LayerRenderer;
|
||||
import org.oscim.renderer.MapRenderer.Matrices;
|
||||
|
||||
|
||||
/*
|
||||
* This is an example how to integrate custom OpenGL drawing routines as map overlay
|
||||
*
|
||||
@ -140,7 +139,7 @@ public class CustomRenderer extends LayerRenderer {
|
||||
return true;
|
||||
}
|
||||
|
||||
private final static String vShaderStr =
|
||||
private final static String vShaderStr = "" +
|
||||
"precision mediump float;"
|
||||
+ "uniform mat4 u_mvp;"
|
||||
+ "attribute vec4 a_pos;"
|
||||
@ -151,7 +150,7 @@ public class CustomRenderer extends LayerRenderer {
|
||||
+ " alpha = a_pos.z;"
|
||||
+ "}";
|
||||
|
||||
private final static String fShaderStr =
|
||||
private final static String fShaderStr = "" +
|
||||
"precision mediump float;"
|
||||
+ "varying float alpha;"
|
||||
+ "void main()"
|
||||
|
@ -27,7 +27,6 @@ import org.oscim.renderer.MapRenderer;
|
||||
import org.oscim.renderer.MapRenderer.Matrices;
|
||||
import org.oscim.utils.FastMath;
|
||||
|
||||
|
||||
/*
|
||||
* This is an example how to integrate custom OpenGL drawing routines as map overlay
|
||||
*
|
||||
@ -133,7 +132,10 @@ public class CustomRenderer2 extends ElementRenderer {
|
||||
float fy = (float) (y + offset_y) / (offset_y * 2);
|
||||
float fx = (float) (x + offset_x) / (offset_x * 2);
|
||||
float fz = FastMath.clamp(
|
||||
(float) (x < 0 || y < 0 ? 1 - Math.sqrt(fx * fx + fy * fy) : 0), 0, 1);
|
||||
(float) (x < 0 || y < 0 ? 1 - Math.sqrt(fx * fx + fy * fy)
|
||||
: 0),
|
||||
0,
|
||||
1);
|
||||
|
||||
int c = 0xff << 24
|
||||
| (int) (0xff * fy) << 16
|
||||
@ -183,7 +185,7 @@ public class CustomRenderer2 extends ElementRenderer {
|
||||
return true;
|
||||
}
|
||||
|
||||
private final static String vShaderStr =
|
||||
private final static String vShaderStr = "" +
|
||||
"precision mediump float;"
|
||||
+ "uniform mat4 u_mvp;"
|
||||
+ "uniform vec2 u_center;"
|
||||
@ -193,7 +195,7 @@ public class CustomRenderer2 extends ElementRenderer {
|
||||
+ " gl_Position = u_mvp * vec4(u_center + a_pos, 0.0, 1.0);"
|
||||
+ "}";
|
||||
|
||||
private final static String fShaderStr =
|
||||
private final static String fShaderStr = "" +
|
||||
"precision mediump float;"
|
||||
+ "varying float alpha;"
|
||||
+ "uniform vec4 u_color;"
|
||||
|
@ -42,7 +42,7 @@ public class SymbolRenderLayer extends ElementRenderer {
|
||||
|
||||
@Override
|
||||
protected void update(MapPosition position, boolean changed, Matrices matrices) {
|
||||
if (initialize){
|
||||
if (initialize) {
|
||||
initialize = false;
|
||||
mMapPosition.copy(position);
|
||||
compile();
|
||||
|
@ -35,7 +35,6 @@ public interface IRenderTheme {
|
||||
*/
|
||||
public abstract RenderInstruction[] matchElement(MapElement element, int zoomLevel);
|
||||
|
||||
|
||||
/**
|
||||
* Must be called when this RenderTheme gets destroyed to clean up and free
|
||||
* resources.
|
||||
@ -69,7 +68,6 @@ public interface IRenderTheme {
|
||||
*/
|
||||
public abstract void scaleTextSize(float scaleFactor);
|
||||
|
||||
|
||||
/**
|
||||
* Callback methods for rendering areas, ways and points of interest (POIs).
|
||||
*/
|
||||
|
@ -50,7 +50,7 @@ class MatchingCacheKey {
|
||||
mTags = new Tag[numTags];
|
||||
|
||||
int result = 7;
|
||||
for (int i = 0; i < numTags; i++){
|
||||
for (int i = 0; i < numTags; i++) {
|
||||
Tag t = tags.tags[i];
|
||||
result = 31 * result + t.hashCode();
|
||||
mTags[i] = t;
|
||||
|
@ -57,7 +57,8 @@ public class RenderTheme implements IRenderTheme {
|
||||
cacheKey = new MatchingCacheKey();
|
||||
matchType = type;
|
||||
}
|
||||
RenderInstructionItem getRenderInstructions(){
|
||||
|
||||
RenderInstructionItem getRenderInstructions() {
|
||||
return cache.get(cacheKey);
|
||||
}
|
||||
}
|
||||
|
@ -337,8 +337,7 @@ public class RenderThemeHandler extends DefaultHandler {
|
||||
}
|
||||
}
|
||||
if (img == null)
|
||||
throw new IllegalArgumentException(
|
||||
"missing attribute 'img' for element: "
|
||||
throw new IllegalArgumentException("missing attribute 'img' for element: "
|
||||
+ elementName);
|
||||
|
||||
Bitmap bitmap = CanvasAdapter.g.loadBitmapAsset(IMG_PATH + img);
|
||||
@ -368,8 +367,7 @@ public class RenderThemeHandler extends DefaultHandler {
|
||||
}
|
||||
}
|
||||
if (regionName == null || r == null)
|
||||
throw new IllegalArgumentException(
|
||||
"missing attribute 'name' or 'rect' for element: "
|
||||
throw new IllegalArgumentException("missing attribute 'name' or 'rect' for element: "
|
||||
+ elementName);
|
||||
|
||||
mTextureAtlas.addTextureRegion(regionName.intern(), r);
|
||||
|
@ -36,7 +36,6 @@ public class ThemeLoader {
|
||||
return load((Theme) internalRenderTheme);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load theme from XML file.
|
||||
*
|
||||
|
@ -22,7 +22,6 @@ import org.oscim.theme.IRenderTheme.Callback;
|
||||
*/
|
||||
public final class Area extends RenderInstruction {
|
||||
|
||||
|
||||
public Area(int fill) {
|
||||
this(0, fill);
|
||||
}
|
||||
@ -39,7 +38,6 @@ public final class Area extends RenderInstruction {
|
||||
texture = null;
|
||||
}
|
||||
|
||||
|
||||
public Area(String style, int fill, int stroke, float strokeWidth,
|
||||
int fade, int level, int blend, int blendFill, TextureItem texture) {
|
||||
|
||||
|
@ -16,13 +16,11 @@ package org.oscim.theme.renderinstruction;
|
||||
|
||||
import org.oscim.theme.IRenderTheme.Callback;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a round area on the map.
|
||||
*/
|
||||
public final class Circle extends RenderInstruction {
|
||||
|
||||
|
||||
public final int level;
|
||||
|
||||
public final int fill;
|
||||
|
@ -22,14 +22,14 @@ import org.oscim.theme.IRenderTheme.Callback;
|
||||
*/
|
||||
public final class Line extends RenderInstruction {
|
||||
|
||||
// static float[] parseFloatArray(String dashString) {
|
||||
// String[] dashEntries = SPLIT_PATTERN.split(dashString);
|
||||
// float[] dashIntervals = new float[dashEntries.length];
|
||||
// for (int i = 0; i < dashEntries.length; ++i) {
|
||||
// dashIntervals[i] = Float.parseFloat(dashEntries[i]);
|
||||
// }
|
||||
// return dashIntervals;
|
||||
// }
|
||||
// static float[] parseFloatArray(String dashString) {
|
||||
// String[] dashEntries = SPLIT_PATTERN.split(dashString);
|
||||
// float[] dashIntervals = new float[dashEntries.length];
|
||||
// for (int i = 0; i < dashEntries.length; ++i) {
|
||||
// dashIntervals[i] = Float.parseFloat(dashEntries[i]);
|
||||
// }
|
||||
// return dashIntervals;
|
||||
// }
|
||||
|
||||
private final int level;
|
||||
|
||||
@ -47,8 +47,6 @@ public final class Line extends RenderInstruction {
|
||||
public final int stippleColor;
|
||||
public final float stippleWidth;
|
||||
|
||||
|
||||
|
||||
public Line(int level, String style, int color, float width,
|
||||
Cap cap, boolean fixed,
|
||||
int stipple, int stippleColor, float stippleWidth,
|
||||
|
@ -27,7 +27,6 @@ import org.oscim.theme.IRenderTheme.Callback;
|
||||
*/
|
||||
public final class Text extends RenderInstruction {
|
||||
|
||||
|
||||
public final String style;
|
||||
|
||||
public final float fontSize;
|
||||
@ -52,12 +51,22 @@ public final class Text extends RenderInstruction {
|
||||
return createText("", fontSize, strokeWidth, fill, outline, billboard);
|
||||
}
|
||||
|
||||
|
||||
public static Text createText(String textKey, float fontSize, float strokeWidth, int fill, int outline,
|
||||
public static Text createText(String textKey, float fontSize, float strokeWidth, int fill,
|
||||
int outline,
|
||||
boolean billboard) {
|
||||
|
||||
Text t = new Text("", textKey, FontFamily.DEFAULT, FontStyle.NORMAL,
|
||||
fontSize, fill, outline, strokeWidth, 0, billboard, null, Integer.MAX_VALUE);
|
||||
Text t = new Text("",
|
||||
textKey,
|
||||
FontFamily.DEFAULT,
|
||||
FontStyle.NORMAL,
|
||||
fontSize,
|
||||
fill,
|
||||
outline,
|
||||
strokeWidth,
|
||||
0,
|
||||
billboard,
|
||||
null,
|
||||
Integer.MAX_VALUE);
|
||||
|
||||
t.fontHeight = t.paint.getFontHeight();
|
||||
t.fontDescent = t.paint.getFontDescent();
|
||||
|
@ -27,8 +27,11 @@ import org.oscim.theme.renderinstruction.RenderInstruction;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
public abstract class Rule {
|
||||
private static final Map<List<String>, AttributeMatcher> MATCHERS_CACHE_KEY = new HashMap<List<String>, AttributeMatcher>();
|
||||
private static final Map<List<String>, AttributeMatcher> MATCHERS_CACHE_VALUE = new HashMap<List<String>, AttributeMatcher>();
|
||||
private static final Map<List<String>, AttributeMatcher> MATCHERS_CACHE_KEY =
|
||||
new HashMap<List<String>, AttributeMatcher>();
|
||||
private static final Map<List<String>, AttributeMatcher> MATCHERS_CACHE_VALUE =
|
||||
new HashMap<List<String>, AttributeMatcher>();
|
||||
|
||||
//private static final Pattern SPLIT_PATTERN = Pattern.compile("\\|");
|
||||
private static final String STRING_NEGATION = "~";
|
||||
private static final String STRING_EXCLUSIVE = "-";
|
||||
@ -132,8 +135,8 @@ public abstract class Rule {
|
||||
throw new IllegalArgumentException("zoom-max must not be negative: "
|
||||
+ zoomMax);
|
||||
} else if (zoomMin > zoomMax) {
|
||||
throw new IllegalArgumentException(
|
||||
"zoom-min must be less or equal zoom-max: " + zoomMin);
|
||||
throw new IllegalArgumentException("zoom-min must be less or equal zoom-max: "
|
||||
+ zoomMin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class TileRenderer extends LayerRenderer {
|
||||
@Override
|
||||
protected void update(MapPosition pos, boolean positionChanged, Matrices m) {
|
||||
|
||||
if (mAlpha == 0){
|
||||
if (mAlpha == 0) {
|
||||
mTileManager.releaseTiles(mDrawTiles);
|
||||
return;
|
||||
}
|
||||
@ -80,7 +80,7 @@ public class TileRenderer extends LayerRenderer {
|
||||
int tileCnt = mDrawTiles.cnt;
|
||||
MapTile[] tiles = mDrawTiles.tiles;
|
||||
|
||||
if (tilesChanged || positionChanged){
|
||||
if (tilesChanged || positionChanged) {
|
||||
updateTileVisibility(pos, m.mapPlane);
|
||||
}
|
||||
|
||||
@ -99,8 +99,6 @@ public class TileRenderer extends LayerRenderer {
|
||||
draw(tiles, tileCnt, pos, m);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void clearTiles() {
|
||||
// Clear all references to MapTiles as all current
|
||||
// tiles will also be removed from TileManager.
|
||||
@ -321,7 +319,7 @@ public class TileRenderer extends LayerRenderer {
|
||||
if (tile == null)
|
||||
continue;
|
||||
|
||||
if (cnt + mNumTileHolder >= tiles.length){
|
||||
if (cnt + mNumTileHolder >= tiles.length) {
|
||||
Log.e(TAG, "too many tiles " + cnt + ", " + mNumTileHolder);
|
||||
break;
|
||||
}
|
||||
@ -487,11 +485,11 @@ public class TileRenderer extends LayerRenderer {
|
||||
PolygonLayer.Renderer.draw(pos, null, m, true, div, true);
|
||||
clipped = true;
|
||||
}
|
||||
// if (!clipped) {
|
||||
// // draw stencil buffer clip region
|
||||
// PolygonRenderer.clip(m);
|
||||
// clipped = true;
|
||||
// }
|
||||
// if (!clipped) {
|
||||
// // draw stencil buffer clip region
|
||||
// PolygonRenderer.clip(m);
|
||||
// clipped = true;
|
||||
// }
|
||||
//GLState.test(false, false);
|
||||
switch (l.type) {
|
||||
case RenderElement.BITMAP:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user