use of org.asassecreations.engine.render.Color 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");
}
}
Aggregations