Skip to content

Instantly share code, notes, and snippets.

@matyklug18
Created January 6, 2020 16:23
Show Gist options
  • Save matyklug18/c8b971578dcd2dca870cc58fc83635a7 to your computer and use it in GitHub Desktop.
Save matyklug18/c8b971578dcd2dca870cc58fc83635a7 to your computer and use it in GitHub Desktop.
for(int x = 0; x < World.maxX; x++)
for(int y = 0; y < World.maxY; y++)
for(int z = 0; y < World.maxZ; z++) {
ChunkMesh msh = world.chunks[x][y][z].opMesh;
Vertex[] vrts = new Vertex[msh.getVerts().size()];
vrts = msh.getVerts().toArray(vrts);
ArrayList<Float> verts = new ArrayList<>(vrts.length*3);
for(Vertex vrt:vrts) {
verts.add(vrt.getPos().x);
verts.add(vrt.getPos().y);
verts.add(vrt.getPos().z);
}
float[] vertices = Floats.toArray(verts);
int[] indices = Ints.toArray(msh.getInds());
triData[x][y][z] = OdeHelper.createTriMeshData();
triData[x][y][z].build(vertices, indices);
triData[x][y][z].preprocess();
DTriMesh triMesh = OdeHelper.createTriMesh(dSpace, triData[x][y][z], null, null, null);
triMesh.setData(triData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment