better way of checking if a chunk needs VBO creation
old way had some concurrency issues on slower hardware
This commit is contained in:
parent
c7505cb8ce
commit
620dc275d1
|
@ -167,8 +167,8 @@ public class TileMap extends TileContainer implements Disposable {
|
||||||
if (!isUpdating())
|
if (!isUpdating())
|
||||||
return true; // done updating (or we were never updating in the first place ...)
|
return true; // done updating (or we were never updating in the first place ...)
|
||||||
|
|
||||||
TileChunk chunkNeedingVboCreation = updater.chunkNeedingVboCreation;
|
if (updater.isWaitingForVboCreation()) {
|
||||||
if (chunkNeedingVboCreation != null) {
|
TileChunk chunkNeedingVboCreation = updater.chunkNeedingVboCreation;
|
||||||
ChunkVertexGenerator.GeneratedChunkMeshes meshes = vertexGenerator.createMeshFromVertices();
|
ChunkVertexGenerator.GeneratedChunkMeshes meshes = vertexGenerator.createMeshFromVertices();
|
||||||
chunkNeedingVboCreation.setMeshes(meshes);
|
chunkNeedingVboCreation.setMeshes(meshes);
|
||||||
updater.signalDoneVboCreation();
|
updater.signalDoneVboCreation();
|
||||||
|
|
|
@ -24,6 +24,10 @@ public class TileMapUpdater implements Runnable {
|
||||||
return chunkNeedingVboCreation;
|
return chunkNeedingVboCreation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isWaitingForVboCreation() {
|
||||||
|
return waitingForVboCreation;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void signalDoneVboCreation() {
|
public synchronized void signalDoneVboCreation() {
|
||||||
waitingForVboCreation = false;
|
waitingForVboCreation = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue