@Override
public void applyParameters(Material program) {
program.setFloat("viewingDistance", CoreRegistry.get(Config.class).getRendering().getViewDistance().getChunkDistance().x * 8.0f);
WorldRenderer worldRenderer = CoreRegistry.get(WorldRenderer.class);
WorldProvider worldProvider = CoreRegistry.get(WorldProvider.class);
if (worldRenderer != null) {
program.setFloat("daylight", worldRenderer.getDaylight(), true);
program.setFloat("swimming", worldRenderer.isHeadUnderWater() ? 1.0f : 0.0f, true);
program.setFloat("tick", worldRenderer.getTick(), true);
program.setFloat("sunlightValueAtPlayerPos", worldRenderer.getSmoothedPlayerSunlightValue(), true);
if (worldRenderer.getActiveCamera() != null) {
final Vector3f cameraDir = worldRenderer.getActiveCamera().getViewingDirection();
final Vector3f cameraPosition = worldRenderer.getActiveCamera().getPosition();
program.setFloat3("cameraPosition", cameraPosition.x, cameraPosition.y, cameraPosition.z, true);
program.setFloat3("cameraDirection", cameraDir.x, cameraDir.y, cameraDir.z, true);
program.setFloat3("cameraParameters", worldRenderer.getActiveCamera().getzNear(), worldRenderer.getActiveCamera().getzFar(), 0.0f, true);
}
Vector3f sunDirection = worldRenderer.getSkysphere().getSunDirection(false);
program.setFloat3("sunVec", sunDirection.x, sunDirection.y, sunDirection.z, true);
}
if (worldProvider != null) {
program.setFloat("time", worldProvider.getTime().getDays());