packIntoAtlas(meshes, 1);
}
private void packIntoAtlas(final List<Mesh> meshes, final int textureIndex) {
// Create an atlas packer with maximum atlas size of 256x256
final TexturePacker packer = new TexturePacker(256, 256);
// Add meshes into atlas (lots of different ways of doing this if you have other source/target
// texture index)
for (final Mesh mesh : meshes) {
packer.insert(mesh, textureIndex, textureIndex); // make the index for the atlases the same as the source
// textures for this case
}
// Create all the atlases (also possible to set filters here)
packer.createAtlases();
// XXX: This is only to write down the atlases to disk for debugging and viewing pleasure
debugDumpAtlases(packer);
}