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;
}
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);
}
}
use of org.asassecreations.voxelgame.world.chunk.Chunk in project Voxel_Game by ASasseCreations.
the class GameState method tick.
public void tick() {
ChunkSystem.removeDistantChunks();
final int cameraChunkX = (int) (GameCamera.position.x / Chunk.H_SIZE);
final int cameraChunkZ = (int) (GameCamera.position.z / Chunk.H_SIZE);
ChunkSystem.addNewChunks(cameraChunkX, cameraChunkZ);
player.tick();
if (MouseInput.isButtonJustPressed(0))
ChunkSystem.checkLeftClick(inventory);
if (MouseInput.isButtonJustPressed(1))
ChunkSystem.checkRightClick();
ChunkModelQueue.queue();
ChunkSaveQueue.queue();
Time.updateTime(1200);
final float time = Mathf.sinNormalized(Time.rawTime);
sun.position.y = -time;
sun.position.x = Mathf.cosNormalized(Time.rawTime) * .2f;
sun.position.z = Mathf.cosNormalized(Time.rawTime);
sun.brightness = Mathf.map(Mathf.max(time, -.4f), 1f, -.4f, 1f, 0f);
Settings.CURRENT_SKY_COLOR = new Color(ImageBilinearFilter.getColor(AMBIENT, sun.brightness, 0));
final Color sunColor = new Color(ImageBilinearFilter.getColor(AMBIENT, sun.brightness, 1));
sun.color = new Vec3(sunColor.getRed(), sunColor.getGreen(), sunColor.getBlue());
Debugger.chunksLoaded = Chunk.CHUNKS.size();
Debugger.playerPosition = player.position;
GameCamera.updateMatrix(Player.sprinting);
if (autosaveTimer.isComplete()) {
autosaveTimer.reset();
for (final Chunk c : Chunk.CHUNKS) new ChunkSaveQueue(c);
PlayerSave.save(player);
inventory.save();
System.out.println("Autosave");
}
}
use of org.asassecreations.voxelgame.world.chunk.Chunk in project Voxel_Game by ASasseCreations.
the class ChunkModelQueue method queue.
public static final void queue() {
int amount = 0;
for (int i = 0; i < LIST.size(); i++) {
final ChunkModelQueue 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.MODELING;
if (chunk.model())
LIST.remove(queue);
amount++;
if (amount >= MAX_SIZE)
break;
}
}
use of org.asassecreations.voxelgame.world.chunk.Chunk in project Voxel_Game by ASasseCreations.
the class ChunkOccludeQueue method contains.
private static final boolean contains(final Chunk chunk) {
if (chunk == null)
return false;
for (int i = 0; i < LIST.size(); i++) {
final ChunkOccludeQueue 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;
}
Aggregations