Debugging, cleanup

This commit is contained in:
Anuken
2018-12-27 20:26:18 -05:00
parent 3fc278c7b7
commit 1e8b844eac
10 changed files with 47 additions and 70 deletions

View File

@@ -14,7 +14,7 @@ import io.anuke.arc.util.Disposable;
public class IndexedRenderer implements Disposable{
private final static int vsize = 5;
private Shader program = createDefaultShader();
private Shader program = BatchShader.create();
private Mesh mesh;
private float[] tmpVerts = new float[vsize * 6];
private float[] vertices;
@@ -28,33 +28,6 @@ public class IndexedRenderer implements Disposable{
resize(sprites);
}
static public Shader createDefaultShader(){
String vertexShader = "attribute vec4 " + Shader.POSITION_ATTRIBUTE + ";\n" //
+ "attribute vec2 " + Shader.TEXCOORD_ATTRIBUTE + "0;\n" //
+ "uniform mat4 u_projTrans;\n" //
+ "varying vec2 v_texCoords;\n" //
+ "\n" //
+ "void main()\n" //
+ "{\n" //
+ " v_texCoords = " + Shader.TEXCOORD_ATTRIBUTE + "0;\n" //
+ " gl_Position = u_projTrans * " + Shader.POSITION_ATTRIBUTE + ";\n" //
+ "}\n";
String fragmentShader = "#ifdef GL_ES\n" //
+ "#define LOWP lowp\n" //
+ "precision mediump float;\n" //
+ "#else\n" //
+ "#define LOWP \n" //
+ "#endif\n" //
+ "varying vec2 v_texCoords;\n" //
+ "uniform sampler2D u_texture;\n" //
+ "void main()\n"//
+ "{\n" //
+ " gl_FragColor = texture2D(u_texture, v_texCoords);\n" //
+ "}";
return new Shader(vertexShader, fragmentShader);
}
public void render(Texture texture){
Core.gl.glEnable(GL20.GL_BLEND);

View File

@@ -67,6 +67,8 @@ public class MinimapRenderer implements Disposable{
}
public void drawEntities(float x, float y, float w, float h){
updateUnitArray();
int sz = baseSize * zoom;
float dx = (Core.camera.position.x / tilesize);
float dy = (Core.camera.position.y / tilesize);