Fixed icosphere generator
This commit is contained in:
@@ -8,6 +8,6 @@ uniform mat4 u_trans;
|
||||
varying vec4 v_col;
|
||||
|
||||
void main(){
|
||||
v_col = a_color;
|
||||
gl_Position = u_proj * u_trans * a_position;
|
||||
v_col = a_color;
|
||||
gl_Position = u_proj * u_trans * a_position;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MeshBuilder{
|
||||
public static Mesh buildIcosphere(int divisions, float radius){
|
||||
MeshResult result = Icosphere.create(divisions);
|
||||
|
||||
Mesh mesh = begin(result.vertices.size / 3, result.indices.size, false, false);
|
||||
Mesh mesh = begin(result.vertices.size / 3, result.indices.size, false, false, false);
|
||||
|
||||
if(result.vertices.size >= 65535) throw new RuntimeException("Due to index size limits, only meshes with a maximum of 65535 vertices are supported. If you want more than that, make your own non-indexed mesh builder.");
|
||||
|
||||
@@ -193,6 +193,10 @@ public class MeshBuilder{
|
||||
}
|
||||
|
||||
private static Mesh begin(int vertices, int indices, boolean normal, boolean emissive){
|
||||
return begin(vertices, indices, normal, emissive, true);
|
||||
}
|
||||
|
||||
private static Mesh begin(int vertices, int indices, boolean normal, boolean emissive, boolean color){
|
||||
Seq<VertexAttribute> attributes = Seq.with(
|
||||
VertexAttribute.position3
|
||||
);
|
||||
@@ -202,7 +206,9 @@ public class MeshBuilder{
|
||||
attributes.add(packNormals ? VertexAttribute.packedNormal : VertexAttribute.normal);
|
||||
}
|
||||
|
||||
attributes.add(VertexAttribute.color);
|
||||
if(color){
|
||||
attributes.add(VertexAttribute.color);
|
||||
}
|
||||
|
||||
if(emissive){
|
||||
attributes.add(new VertexAttribute(4, GL20.GL_UNSIGNED_BYTE, true, "a_emissive"));
|
||||
|
||||
Reference in New Issue
Block a user