51 lines
2.1 KiB
Java
51 lines
2.1 KiB
Java
package openonyx.render;
|
|
|
|
import openonyx.core.MinecraftAccess;
|
|
import openonyx.core.OnyxClient;
|
|
import openonyx.features.render.Ambience;
|
|
import openonyx.render.group_p.ShaderProgram;
|
|
import openonyx.theme.internal.ColorUtils;
|
|
|
|
public final class AmbienceShader implements MinecraftAccess {
|
|
private static ShaderProgram shaderProgram;
|
|
private static boolean H;
|
|
private static final long e = System.nanoTime();
|
|
|
|
private AmbienceShader() {
|
|
}
|
|
|
|
public static void L() {
|
|
if (OnyxClient.moduleManager != null) {
|
|
Ambience ambience = OnyxClient.moduleManager.ambience;
|
|
if (OnyxClient.moduleManager.ambience.I() && PostProcessor.L()) {
|
|
if (!H) {
|
|
H = true;
|
|
shaderProgram = ShaderProgram.load("onyx_ambience");
|
|
}
|
|
|
|
if (shaderProgram != null && shaderProgram.isLoaded()) {
|
|
boolean bl = ambience.ambiencePart2.isEnabled();
|
|
boolean bl1 = ambience.ambiencePart.isEnabled();
|
|
int i = bl ? ambience.ambiencePart2.color.getOpaque() : -1;
|
|
float k = bl ? ambience.ambiencePart2.strength.getFloat() / 100.0F : 0.0F;
|
|
float f = bl1 ? ambience.ambiencePart.saturation.getFloat() / 100.0F : 1.0F;
|
|
float g = bl1 ? ambience.ambiencePart.contrast.getFloat() / 100.0F : 1.0F;
|
|
float h = bl1 ? ambience.ambiencePart.vignette.getFloat() / 100.0F : 0.0F;
|
|
float l = bl1 ? ambience.ambiencePart.filmGrain.getFloat() / 100.0F : 0.0F;
|
|
float j = (float)(System.nanoTime() - e) / 1.0E9F;
|
|
PostProcessor.L(
|
|
shaderProgram,
|
|
shaderProgram -> {
|
|
shaderProgramx.setUniform4f(
|
|
"uLightColorAndStrength", ColorUtils.red(i) / 255.0F, ColorUtils.green(i) / 255.0F, ColorUtils.blue(i) / 255.0F, k
|
|
);
|
|
shaderProgramx.setUniform4f("uGradeParams", f, g, h, l);
|
|
shaderProgramx.setUniform1f("uTime", j);
|
|
}
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|