@@ -0,0 +1,1165 @@
+package ca.blarg.gdx.tilemap3d;%0A%0Apublic class TileMapUpdater implements Runnable %7B%0A%09final TileMap tileMap;%0A%0A%09boolean waitingForVboCreation;%0A%09TileChunk chunkNeedingVboCreation;%0A%09float progress;%0A%09boolean isRunning;%0A%0A%09public TileMapUpdater(TileMap tileMap) %7B%0A%09%09this.tileMap = tileMap;%0A%09%7D%0A%0A%09public float currentProgress() %7B%0A%09%09return progress;%0A%09%7D%0A%0A%09public boolean isUpdating() %7B%0A%09%09return isRunning;%0A%09%7D%0A%0A%09public TileChunk getChunkNeedingVboCreation() %7B%0A%09%09return chunkNeedingVboCreation;%0A%09%7D%0A%0A%09public synchronized void signalDoneVboCreation() %7B%0A%09%09waitingForVboCreation = false;%0A%09%7D%0A%0A%09@Override%0A%09public void run() %7B%0A%09%09isRunning = true;%0A%0A%09%09TileChunk%5B%5D chunks = tileMap.getChunks();%0A%0A%09%09for (int i = 0; i %3C tileMap.chunks.length; ++i) %7B%0A%09%09%09progress = (float)i / (float)(chunks.length - 1);%0A%0A%09%09%09TileChunk chunk = chunks%5Bi%5D;%0A%09%09%09tileMap.vertexGenerator.generateVertices(chunk);%0A%09%09%09chunkNeedingVboCreation = chunk;%0A%09%09%09waitingForVboCreation = true;%0A%0A%09%09%09// wait for the render thread to take care of VBO creation and single to us that it's done%0A%09%09%09while (waitingForVboCreation)%0A%09%09%09%09Thread.yield();%0A%0A%09%09%09chunkNeedingVboCreation = null;%0A%09%09%7D%0A%0A%09%09progress = 1.0f;%0A%09%09isRunning = false;%0A%09%7D%0A%7D%0A

add Runnable class to handle the processing to be done in another thread