package electrosphere.game.client;

import electrosphere.entity.CameraEntityUtils;
import electrosphere.entity.EntityUtils;
import electrosphere.main.Globals;
import org.joml.Vector3f;

/**
 *
 * @author amaterasu
 */
public class ClientFunctions {
    public static void runClientFunctions(){
        if(Globals.clientTerrainManager != null){
            Globals.clientTerrainManager.handleMessages();
            Globals.clientTerrainManager.ejectLoadedChunks();
        }
        updateSkyboxPos();
    }
    
    static void updateSkyboxPos(){
        if(Globals.skybox != null && Globals.playerCharacter != null){
//            Vector3f skyboxPos = EntityUtils.getPosition(Globals.skybox);
//            
//            Vector3f playerCameraPos = EntityUtils.getPosition(Globals.playerCamera);
//            if(skyboxPos != null && playerCameraPos != null){
//                skyboxPos.set(playerCameraPos);
//            }
            EntityUtils.getPosition(Globals.skybox).set(EntityUtils.getPosition(Globals.playerCharacter));
        }
    }
}
