Skip to content

Commit

Permalink
Merge pull request IrisShaders#433 from IMS212/trunkpr2
Browse files Browse the repository at this point in the history
Fix world time on Complementary
  • Loading branch information
coderbot16 authored Jun 26, 2021
2 parents 114b384 + 3c3065d commit 6f52497
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ public static void addHardcodedCustomUniforms(UniformHolder holder, FrameUpdateN
}

private static float getTimeAngle() {
float sunAngle = CelestialUniforms.getSunAngle();
float tAmin = frac(sunAngle - 0.033333333f);
float tAlin = tAmin < 0.433333333f ? (tAmin * 1.15384615385f) : (tAmin * 0.882352941176f + 0.117647058824f);
float hA = tAlin > 0.5f ? 1.0f : 0.0f;
float tAfrc = frac(tAlin * 2.0f);
float tAfrs = tAfrc*tAfrc*(3.0f-2.0f*tAfrc);
float tAmix = hA < 0.5f ? 0.3f : -0.1f;

return (tAfrc * (1.0f-tAmix) + tAfrs * tAmix + hA) * 0.5f;
return getWorldDayTime() / 24000F;
}

private static int getWorldDayTime() {
long timeOfDay = MinecraftClient.getInstance().world.getTimeOfDay();
long dayTime = timeOfDay % 24000L;

return (int) dayTime;
}

private static float getTimeBrightness() {
Expand Down

0 comments on commit 6f52497

Please sign in to comment.