Made IndexedRenderer shader static
This commit is contained in:
@@ -9,7 +9,7 @@ import arc.util.*;
|
|||||||
public class IndexedRenderer implements Disposable{
|
public class IndexedRenderer implements Disposable{
|
||||||
private static final int vsize = 5;
|
private static final int vsize = 5;
|
||||||
|
|
||||||
private final Shader program = new Shader(
|
private final static Shader program = new Shader(
|
||||||
"""
|
"""
|
||||||
attribute vec4 a_position;
|
attribute vec4 a_position;
|
||||||
attribute vec4 a_color;
|
attribute vec4 a_color;
|
||||||
@@ -34,9 +34,9 @@ public class IndexedRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
);
|
);
|
||||||
|
private static final float[] tmpVerts = new float[vsize * 6];
|
||||||
|
|
||||||
private Mesh mesh;
|
private Mesh mesh;
|
||||||
private float[] tmpVerts = new float[vsize * 6];
|
|
||||||
private float[] vertices;
|
|
||||||
|
|
||||||
private Mat projMatrix = new Mat();
|
private Mat projMatrix = new Mat();
|
||||||
private Mat transMatrix = new Mat();
|
private Mat transMatrix = new Mat();
|
||||||
@@ -57,7 +57,7 @@ public class IndexedRenderer implements Disposable{
|
|||||||
|
|
||||||
program.setUniformMatrix4("u_projTrans", combined);
|
program.setUniformMatrix4("u_projTrans", combined);
|
||||||
|
|
||||||
mesh.render(program, Gl.triangles, 0, vertices.length / vsize);
|
mesh.render(program, Gl.triangles, 0, mesh.getMaxVertices());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(Color color){
|
public void setColor(Color color){
|
||||||
@@ -203,8 +203,9 @@ public class IndexedRenderer implements Disposable{
|
|||||||
VertexAttribute.position,
|
VertexAttribute.position,
|
||||||
VertexAttribute.color,
|
VertexAttribute.color,
|
||||||
VertexAttribute.texCoords);
|
VertexAttribute.texCoords);
|
||||||
vertices = new float[6 * sprites * vsize];
|
|
||||||
mesh.setVertices(vertices);
|
//TODO why is this the only way to get it working properly? it should not need an array
|
||||||
|
mesh.setVertices(new float[6 * sprites * vsize]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMatrix(){
|
private void updateMatrix(){
|
||||||
|
|||||||
Reference in New Issue
Block a user