more refactoring. can now also render TileChunks separately
This commit is contained in:
parent
1514bddf14
commit
4b30f313b6
|
@ -4,12 +4,14 @@ import com.badlogic.gdx.graphics.Camera;
|
||||||
import com.badlogic.gdx.graphics.g3d.ModelBatch;
|
import com.badlogic.gdx.graphics.g3d.ModelBatch;
|
||||||
|
|
||||||
public class TileMapRenderer {
|
public class TileMapRenderer {
|
||||||
public void render(ModelBatch modelBatch, Camera camera, TileMap tileMap) {
|
public void render(ModelBatch modelBatch, TileMap tileMap, Camera camera) {
|
||||||
TileChunk[] chunks = tileMap.chunks;
|
TileChunk[] chunks = tileMap.chunks;
|
||||||
for (int i = 0; i < chunks.length; ++i) {
|
for (int i = 0; i < chunks.length; ++i)
|
||||||
TileChunk chunk = chunks[i];
|
render(modelBatch, chunks[i], camera);
|
||||||
if (camera.frustum.boundsInFrustum(chunk.getMeshBounds()))
|
}
|
||||||
modelBatch.render(chunk);
|
|
||||||
}
|
public void render(ModelBatch modelBatch, TileChunk chunk, Camera camera) {
|
||||||
|
if (camera.frustum.boundsInFrustum(chunk.getMeshBounds()))
|
||||||
|
modelBatch.render(chunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue