v0.4.2: fixes to tilemap
This commit is contained in:
parent
0b30263236
commit
e87ce8949e
|
@ -51,6 +51,7 @@ public class Tilemap extends Visual {
|
||||||
protected Vertexbuffer buffer;
|
protected Vertexbuffer buffer;
|
||||||
|
|
||||||
private volatile Rect updated;
|
private volatile Rect updated;
|
||||||
|
private boolean fullUpdate;
|
||||||
private Rect updating;
|
private Rect updating;
|
||||||
private int topLeftUpdating;
|
private int topLeftUpdating;
|
||||||
private int bottomRightUpdating;
|
private int bottomRightUpdating;
|
||||||
|
@ -94,10 +95,7 @@ public class Tilemap extends Visual {
|
||||||
//forces a full update, including new buffer and culling recalculation
|
//forces a full update, including new buffer and culling recalculation
|
||||||
public synchronized void updateMap(){
|
public synchronized void updateMap(){
|
||||||
updated.set( 0, 0, mapWidth, mapHeight );
|
updated.set( 0, 0, mapWidth, mapHeight );
|
||||||
if (buffer != null) {
|
fullUpdate = true;
|
||||||
buffer.delete();
|
|
||||||
}
|
|
||||||
buffer = null;
|
|
||||||
camX = null;
|
camX = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,10 +200,16 @@ public class Tilemap extends Visual {
|
||||||
quads.limit(bufferLength*16);
|
quads.limit(bufferLength*16);
|
||||||
if (buffer == null)
|
if (buffer == null)
|
||||||
buffer = new Vertexbuffer(quads);
|
buffer = new Vertexbuffer(quads);
|
||||||
else
|
else {
|
||||||
buffer.updateVertices(quads,
|
if (fullUpdate) {
|
||||||
topLeftUpdating*16,
|
buffer.updateVertices(quads);
|
||||||
bottomRightUpdating*16);
|
fullUpdate = false;
|
||||||
|
} else {
|
||||||
|
buffer.updateVertices(quads,
|
||||||
|
topLeftUpdating * 16,
|
||||||
|
bottomRightUpdating * 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
topLeftUpdating = 0;
|
topLeftUpdating = 0;
|
||||||
updating.setEmpty();
|
updating.setEmpty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user