Skip to content

Commit

Permalink
Elevators no longer rebuild static meshes
Browse files Browse the repository at this point in the history
  • Loading branch information
Interrupt committed Jan 10, 2019
1 parent fc1c56c commit 8c044ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Expand Up @@ -132,7 +132,7 @@ public void tick(Level level, float delta) {
private void markWorldAsDirty(int xPos, int yPos) {
WorldChunk chunk = GameManager.renderer.GetWorldChunkAt(xPos, yPos);
if(chunk != null) {
chunk.hasBuilt = false;
chunk.needsRetessellation = true;
}
}
}
Expand Up @@ -2589,7 +2589,7 @@ public void Tesselate(Level level)
// Might need to update these chunks if lights have changed
for (int i = 0; i < chunks.size; i++) {
WorldChunk c = chunks.get(i);
if(c != null && !c.hasBuilt) {
if(c != null && (!c.hasBuilt || c.needsRetessellation)) {
triangleSpatialHash.dropWorldChunk(c);
c.Tesselate(loadedLevel, this);
c.tesselators.world.addCollisionTriangles(triangleSpatialHash);
Expand Down
2 changes: 2 additions & 0 deletions Dungeoneer/src/com/interrupt/dungeoneer/gfx/WorldChunk.java
Expand Up @@ -44,6 +44,7 @@ public class WorldChunk {

public boolean visible = true;
public boolean hasBuilt = false;
public boolean needsRetessellation = false;

public ArrayMap<String,Array<Mesh>> staticMeshBatch = null;

Expand Down Expand Up @@ -146,6 +147,7 @@ public void AddEntityForEditor(Entity e, Level level) {
public void Tesselate(Level level, GlRenderer renderer)
{
tesselator.Tesselate(level, renderer, this, xOffset, yOffset, width, height, tesselators, makeFloors, makeCeilings, makeWalls, true);
needsRetessellation = false;

if(hasBuilt) return;
hasBuilt = true;
Expand Down

0 comments on commit 8c044ed

Please sign in to comment.