This commit is contained in:
Anuken
2020-07-03 16:41:06 -04:00
parent 843a8c3e56
commit 7ff2e98420
11 changed files with 42 additions and 47 deletions

View File

@@ -12,29 +12,28 @@ public class IndexedRenderer implements Disposable{
private final static int vsize = 5;
private Shader program = new Shader(
Strings.join("\n",
"attribute vec4 " + Shader.positionAttribute + ";",
"attribute vec4 " + Shader.colorAttribute + ";",
"attribute vec2 " + Shader.texcoordAttribute + "0;",
"uniform mat4 u_projTrans;",
"varying vec4 v_color;",
"varying vec2 v_texCoords;",
"",
"void main(){",
" v_color = " + Shader.colorAttribute + ";",
" v_color.a = v_color.a * (255.0/254.0);",
" v_texCoords = " + Shader.texcoordAttribute + "0;",
" gl_Position = u_projTrans * " + Shader.positionAttribute + ";",
"}"),
Strings.join("\n",
"varying lowp vec4 v_color;",
"varying vec2 v_texCoords;",
"uniform sampler2D u_texture;",
"",
"void main(){",
" gl_FragColor = v_color * texture2D(u_texture, v_texCoords);",
"attribute vec4 a_position;\n" +
"attribute vec4 a_color;\n" +
"attribute vec2 a_texCoord0;\n" +
"uniform mat4 u_projTrans;\n" +
"varying vec4 v_color;\n" +
"varying vec2 v_texCoords;\n" +
"void main(){\n" +
" v_color = a_color;\n" +
" v_color.a = v_color.a * (255.0/254.0);\n" +
" v_texCoords = a_texCoord0;\n" +
" gl_Position = u_projTrans * a_position;\n" +
"}",
"varying lowp vec4 v_color;\n" +
"varying vec2 v_texCoords;\n" +
"uniform sampler2D u_texture;\n" +
"void main(){\n" +
" gl_FragColor = v_color * texture2D(u_texture, v_texCoords);\n" +
"}"
));
);
private Mesh mesh;
private float[] tmpVerts = new float[vsize * 6];
private float[] vertices;