This commit is contained in:
Anuken
2021-06-20 09:50:25 -04:00
parent 5d74795c02
commit 448d1e2c77
27 changed files with 63 additions and 84 deletions

View File

@@ -10,27 +10,29 @@ public class IndexedRenderer implements Disposable{
private static final int vsize = 5;
private final Shader program = new Shader(
"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" +
"""
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoords;
void main(){
v_color = a_color;
v_color.a = v_color.a * (255.0/254.0);
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}
""",
"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" +
"}"
"""
varying lowp vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main(){
gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
}
"""
);
private Mesh mesh;
private float[] tmpVerts = new float[vsize * 6];