enable experimental tile textures
This commit is contained in:
parent
be49146da5
commit
3f63cc95bb
BIN
vtm/assets/grass2.png
Normal file
BIN
vtm/assets/grass2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
vtm/assets/grass3.png
Normal file
BIN
vtm/assets/grass3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
BIN
vtm/assets/water2.png
Normal file
BIN
vtm/assets/water2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
@ -18,9 +18,11 @@ import java.nio.ByteBuffer;
|
|||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
|
|
||||||
|
import org.oscim.backend.CanvasAdapter;
|
||||||
import org.oscim.backend.GL20;
|
import org.oscim.backend.GL20;
|
||||||
import org.oscim.backend.GLAdapter;
|
import org.oscim.backend.GLAdapter;
|
||||||
import org.oscim.backend.Log;
|
import org.oscim.backend.Log;
|
||||||
|
import org.oscim.backend.canvas.Bitmap;
|
||||||
import org.oscim.core.MapPosition;
|
import org.oscim.core.MapPosition;
|
||||||
import org.oscim.renderer.GLRenderer;
|
import org.oscim.renderer.GLRenderer;
|
||||||
import org.oscim.renderer.GLRenderer.Matrices;
|
import org.oscim.renderer.GLRenderer.Matrices;
|
||||||
@ -46,8 +48,6 @@ public final class PolygonRenderer {
|
|||||||
|
|
||||||
private static PolygonLayer[] mFillPolys;
|
private static PolygonLayer[] mFillPolys;
|
||||||
|
|
||||||
private static boolean enableTexture = false;
|
|
||||||
|
|
||||||
private static int numShaders = 2;
|
private static int numShaders = 2;
|
||||||
private static int polyShader = 0;
|
private static int polyShader = 0;
|
||||||
private static int texShader = 1;
|
private static int texShader = 1;
|
||||||
@ -59,6 +59,7 @@ public final class PolygonRenderer {
|
|||||||
private static int[] hPolygonColor = new int[numShaders];
|
private static int[] hPolygonColor = new int[numShaders];
|
||||||
private static int[] hPolygonScale = new int[numShaders];
|
private static int[] hPolygonScale = new int[numShaders];
|
||||||
|
|
||||||
|
private static boolean enableTexture = true;
|
||||||
private static int mTexWater;
|
private static int mTexWater;
|
||||||
private static int mTexWood;
|
private static int mTexWood;
|
||||||
private static int mTexGrass;
|
private static int mTexGrass;
|
||||||
@ -94,35 +95,33 @@ public final class PolygonRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mFillPolys = new PolygonLayer[STENCIL_BITS];
|
mFillPolys = new PolygonLayer[STENCIL_BITS];
|
||||||
// if (enableTexture) {
|
if (enableTexture) {
|
||||||
// mTexWood = loadSprite("jar:grass3.png");
|
mTexWood = loadSprite("grass3.png");
|
||||||
// mTexWater = loadSprite("jar:water2.png");
|
mTexWater = loadSprite("water2.png");
|
||||||
// mTexGrass = loadSprite("jar:grass2.png");
|
mTexGrass = loadSprite("grass2.png");
|
||||||
// }
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private static int loadSprite(String name) {
|
private static int loadSprite(String name) {
|
||||||
// int[] textures = new int[1];
|
int[] textures;
|
||||||
//
|
|
||||||
// try {
|
|
||||||
//Bitmap b = BitmapUtils.createBitmap(name);
|
//Bitmap b = BitmapUtils.createBitmap(name);
|
||||||
// GL.glGenTextures(1, textures, 0);
|
Bitmap b = CanvasAdapter.g.loadBitmapAsset(name);
|
||||||
//
|
if (b == null) {
|
||||||
// GL.glBindTexture(GL20.GL_TEXTURE_2D, textures[0]);
|
Log.d(TAG, "missing asset: " + name);
|
||||||
//
|
return 0;
|
||||||
// GlUtils.setTextureParameter(GL20.GL_LINEAR, GL20.GL_LINEAR,
|
}
|
||||||
// GL20.GL_REPEAT, GL20.GL_REPEAT);
|
textures = GlUtils.glGenTextures(1);
|
||||||
//
|
GL.glBindTexture(GL20.GL_TEXTURE_2D, textures[0]);
|
||||||
// b.uploadToTexture(false);
|
|
||||||
//
|
GlUtils.setTextureParameter(GL20.GL_LINEAR, GL20.GL_LINEAR,
|
||||||
// //GLUtils.texImage2D(GL20.GL_TEXTURE_2D, 0, b, 0);
|
GL20.GL_REPEAT, GL20.GL_REPEAT);
|
||||||
//
|
|
||||||
// } catch (IOException e) {
|
b.uploadToTexture(false);
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
return textures[0];
|
||||||
// return textures[0];
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
private static void fillPolygons(Matrices m, int start, int end, int zoom, float scale,
|
private static void fillPolygons(Matrices m, int start, int end, int zoom, float scale,
|
||||||
float div) {
|
float div) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user