Search in sources :

Example 1 with ChunksIterator

use of io.xol.chunkstories.api.world.chunk.ChunksIterator in project chunkstories by Hugobros3.

the class WorldImplementation method redrawEverything.

@Override
public synchronized // TODO move to client
void redrawEverything() {
    ChunksIterator i = this.getAllLoadedChunks();
    Chunk c;
    while (i.hasNext()) {
        c = i.next();
        if (c instanceof ChunkRenderable) {
            ChunkRenderable c2 = (ChunkRenderable) c;
            c2.lightBaker().requestLightningUpdate();
            c2.meshUpdater().requestMeshUpdate();
        }
    }
}
Also used : ChunkRenderable(io.xol.chunkstories.api.rendering.world.chunk.ChunkRenderable) WorldChunksIterator(io.xol.chunkstories.world.iterators.WorldChunksIterator) ChunksIterator(io.xol.chunkstories.api.world.chunk.ChunksIterator) Chunk(io.xol.chunkstories.api.world.chunk.Chunk) CubicChunk(io.xol.chunkstories.world.chunk.CubicChunk)

Example 2 with ChunksIterator

use of io.xol.chunkstories.api.world.chunk.ChunksIterator in project chunkstories by Hugobros3.

the class DebugInfoRenderer method getLoadedChunksVramFootprint.

@SuppressWarnings("unused")
private String getLoadedChunksVramFootprint() {
    int nbChunks = 0;
    long octelsTotal = 0;
    ChunksIterator i = world.getAllLoadedChunks();
    Chunk c;
    while (i.hasNext()) {
        c = i.next();
        if (c == null)
            continue;
        if (c instanceof ChunkRenderable) {
            ChunkRenderDataHolder chunkRenderData = ((ClientChunk) c).getChunkRenderData();
            if (chunkRenderData != null) {
                nbChunks++;
            // octelsTotal += chunkRenderData.getVramUsage();
            }
        }
    }
    // , storing " + octelsTotal / 1024 / 1024 + "Mb of vertex data.";
    return nbChunks + " chunks";
}
Also used : ChunkRenderDataHolder(io.xol.chunkstories.renderer.chunks.ChunkRenderDataHolder) ChunkRenderable(io.xol.chunkstories.api.rendering.world.chunk.ChunkRenderable) ChunksIterator(io.xol.chunkstories.api.world.chunk.ChunksIterator) Chunk(io.xol.chunkstories.api.world.chunk.Chunk) ClientChunk(io.xol.chunkstories.world.chunk.ClientChunk) ClientChunk(io.xol.chunkstories.world.chunk.ClientChunk)

Aggregations

ChunkRenderable (io.xol.chunkstories.api.rendering.world.chunk.ChunkRenderable)2 Chunk (io.xol.chunkstories.api.world.chunk.Chunk)2 ChunksIterator (io.xol.chunkstories.api.world.chunk.ChunksIterator)2 ChunkRenderDataHolder (io.xol.chunkstories.renderer.chunks.ChunkRenderDataHolder)1 ClientChunk (io.xol.chunkstories.world.chunk.ClientChunk)1 CubicChunk (io.xol.chunkstories.world.chunk.CubicChunk)1 WorldChunksIterator (io.xol.chunkstories.world.iterators.WorldChunksIterator)1