Search in sources :

Example 1 with Chunk

use of org.asassecreations.voxelgame.world.chunk.Chunk in project Voxel_Game by ASasseCreations.

the class ChunkGeneratorQueue method queue.

private static final void queue() {
    for (int i = 0; i < LIST.size(); i++) {
        final ChunkGeneratorQueue queue = LIST.get(i);
        if (queue == null)
            continue;
        if (!Chunk.CHUNKS.contains(queue.chunk)) {
            LIST.remove(queue);
            continue;
        }
        final Chunk chunk = queue.chunk;
        if (chunk == null)
            continue;
        if (chunk.operation == null)
            chunk.operation = ChunkOperation.GENERATING;
        if (chunk.generate())
            LIST.remove(queue);
    }
}
Also used : Chunk(org.asassecreations.voxelgame.world.chunk.Chunk)

Example 2 with Chunk

use of org.asassecreations.voxelgame.world.chunk.Chunk in project Voxel_Game by ASasseCreations.

the class ChunkGeneratorQueue method contains.

private static final boolean contains(final Chunk chunk) {
    if (chunk == null)
        return false;
    for (int i = 0; i < LIST.size(); i++) {
        final ChunkGeneratorQueue queue = LIST.get(i);
        if (queue == null)
            continue;
        final Chunk temp = queue.chunk;
        if (temp == null)
            continue;
        if (temp.x == chunk.x && temp.z == chunk.z)
            return true;
    }
    return false;
}
Also used : Chunk(org.asassecreations.voxelgame.world.chunk.Chunk)

Example 3 with Chunk

use of org.asassecreations.voxelgame.world.chunk.Chunk in project Voxel_Game by ASasseCreations.

the class ChunkModelQueue method contains.

private static final boolean contains(final Chunk chunk) {
    if (chunk == null)
        return false;
    for (int i = 0; i < LIST.size(); i++) {
        final ChunkModelQueue queue = LIST.get(i);
        if (queue == null)
            continue;
        final Chunk temp = queue.chunk;
        if (temp == null)
            continue;
        if (temp.x == chunk.x && temp.z == chunk.z)
            return true;
    }
    return false;
}
Also used : Chunk(org.asassecreations.voxelgame.world.chunk.Chunk)

Example 4 with Chunk

use of org.asassecreations.voxelgame.world.chunk.Chunk in project Voxel_Game by ASasseCreations.

the class ChunkOccludeQueue method queue.

private static final void queue() {
    for (int i = 0; i < LIST.size(); i++) {
        final ChunkOccludeQueue queue = LIST.get(i);
        if (queue == null)
            continue;
        if (!Chunk.CHUNKS.contains(queue.chunk)) {
            LIST.remove(queue);
            continue;
        }
        final Chunk chunk = queue.chunk;
        if (chunk == null)
            continue;
        if (chunk.operation == null)
            chunk.operation = ChunkOperation.OCCLUDING;
        if (chunk.occlude())
            LIST.remove(queue);
    }
}
Also used : Chunk(org.asassecreations.voxelgame.world.chunk.Chunk)

Example 5 with Chunk

use of org.asassecreations.voxelgame.world.chunk.Chunk in project Voxel_Game by ASasseCreations.

the class ChunkMinimapRenderer method render.

public static final void render() {
    shader.start();
    Renderer.blendFunction(BlendFunction.NONE);
    for (final Chunk chunk : Chunk.CHUNKS) {
        if (chunk.model == null || !chunk.render)
            continue;
        GL30.glBindVertexArray(chunk.model.id);
        GL20.glEnableVertexAttribArray(0);
        GL20.glEnableVertexAttribArray(1);
        GL20.glEnableVertexAttribArray(2);
        shader.loadTransformationMatrix(MatrixCreation.createTransformationMatrix(new Vec3(chunk.x * Chunk.H_SIZE, 0, chunk.z * Chunk.H_SIZE), new Vec3(), new Vec3(1, 1, 1)));
        GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, chunk.model.vertexCount);
        GL20.glDisableVertexAttribArray(0);
        GL20.glDisableVertexAttribArray(1);
        GL20.glDisableVertexAttribArray(2);
        GL30.glBindVertexArray(0);
    }
    shader.stop();
}
Also used : Vec3(org.asassecreations.engine.math.vector.Vec3) Chunk(org.asassecreations.voxelgame.world.chunk.Chunk)

Aggregations

Chunk (org.asassecreations.voxelgame.world.chunk.Chunk)12 Vec3 (org.asassecreations.engine.math.vector.Vec3)2 Color (org.asassecreations.engine.render.Color)1 TextureProperties (org.asassecreations.engine.texture.TextureProperties)1 BlockModeled (org.asassecreations.voxelgame.world.block.BlockModeled)1 ChunkSaveQueue (org.asassecreations.voxelgame.world.chunk.queue.ChunkSaveQueue)1