better way of checking if a chunk needs VBO creation

old way had some concurrency issues on slower hardware
This commit is contained in:
Gered 2014-03-16 11:14:34 -04:00
parent c7505cb8ce
commit 620dc275d1
2 changed files with 6 additions and 2 deletions

View file

@ -167,8 +167,8 @@ public class TileMap extends TileContainer implements Disposable {
if (!isUpdating())
return true; // done updating (or we were never updating in the first place ...)
if (updater.isWaitingForVboCreation()) {
TileChunk chunkNeedingVboCreation = updater.chunkNeedingVboCreation;
if (chunkNeedingVboCreation != null) {
ChunkVertexGenerator.GeneratedChunkMeshes meshes = vertexGenerator.createMeshFromVertices();
chunkNeedingVboCreation.setMeshes(meshes);
updater.signalDoneVboCreation();

View file

@ -24,6 +24,10 @@ public class TileMapUpdater implements Runnable {
return chunkNeedingVboCreation;
}
public boolean isWaitingForVboCreation() {
return waitingForVboCreation;
}
public synchronized void signalDoneVboCreation() {
waitingForVboCreation = false;
}