y = yForce;
z = zForce;
}
float sunWeight;
Vector4f skyColor;
float yAbs = Math.abs(y);
if (yAbs < sunSize) {
sunWeight = (y + sunSize) / sunSize / 2.0f;
Vector4f weightedSun;
if (y < 0) {
weightedSun = dawnColor;
} else {
float dawnWeight = y / sunSize;
weightedSun = sunColor.mul(dawnWeight).add(dawnColor.mul(1 - dawnWeight));
}
skyColor = weightedSun.mul(sunWeight).add(moonColor.mul((1 - sunWeight)));
} else {
if (y < 0) {
sunWeight = 0;
skyColor = moonColor;
} else {
sunWeight = 1;
skyColor = sunColor;
}
}
snapshotRender.getMaterial().getShader().setUniform("ambient", ambient);
snapshotRender.getMaterial().getShader().setUniform("skyColor", skyColor);
snapshotRender.getMaterial().getShader().setUniform("sunColor", sunColor.mul(sunWeight));
snapshotRender.getMaterial().getShader().setUniform("moonColor", moonColor.mul(1 - sunWeight));
Vector4f sunDir = new Vector4f(x * size, y * size, z * size, 1.0f);
//Spout.getLogger().info("f = " + f + " rads = " + rads + " vector " + sunDir);
snapshotRender.getMaterial().getShader().setUniform("sunDir", sunDir);
}