I’m attempting to create some sort a voxel engine, and I am using LibGDX to help me. I want to create 16^3 chunks, so 24 vertices per cube at 4096 is 98,304 vertices to be used. However, when I try to build a single chunk mesh with the MeshPartBuilder class I get the error “Too many vertices used”. I took a look at the code, and it seems like you can only add Short.MAX_VALUE vertices, which I don’t understand because a short can’t hold THAT many values. Is there anyway to increase the number of vertices I can put into a mesh? Or am I doing something wrong?
This is my code (be aware I just started to look into the 3D API, so I don’t exactly know what I’m doing.):
ModelBuilder builder = new ModelBuilder();
builder.begin();
MeshPartBuilder mpb = builder.part("cubes", GL20.GL_TRIANGLES, (Usage.Position | Usage.Normal), new Material(ColorAttribute.createDiffuse(Color.WHITE)));
for(int x = 0; x < noise.length; x++) {
for(int y = 0; y < noise[0].length; y++) {
float z = (int) (noise[x][y] * 16);
mpb.box(x, z, y, 1, 1, 1);
}
}
Model model = builder.end();
instance = new ModelInstance(model);