update TileMapRenderer
This commit is contained in:
parent
e506d13d21
commit
70d9ce0c89
|
@ -5,19 +5,11 @@ import com.badlogic.gdx.graphics.g3d.ModelBatch;
|
|||
|
||||
public class TileMapRenderer {
|
||||
public void render(ModelBatch modelBatch, Camera camera, TileMap tileMap) {
|
||||
for (int y = 0; y < tileMap.heightInChunks; ++y)
|
||||
{
|
||||
for (int z = 0; z < tileMap.depthInChunks; ++z)
|
||||
{
|
||||
for (int x = 0; x < tileMap.widthInChunks; ++x)
|
||||
{
|
||||
TileChunk chunk = tileMap.getChunk(x, y, z);
|
||||
if (chunk.mesh.mesh.getNumVertices() > 0 && camera.frustum.boundsInFrustum(chunk.mesh.bounds))
|
||||
modelBatch.render(chunk.mesh);
|
||||
if (chunk.alphaMesh.mesh.getNumVertices() > 0 && camera.frustum.boundsInFrustum(chunk.alphaMesh.bounds))
|
||||
modelBatch.render(chunk.alphaMesh);
|
||||
}
|
||||
}
|
||||
TileChunk[] chunks = tileMap.chunks;
|
||||
for (int i = 0; i < chunks.length; ++i) {
|
||||
TileChunk chunk = chunks[i];
|
||||
if (camera.frustum.boundsInFrustum(chunk.getMeshBounds()))
|
||||
modelBatch.render(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue