Upload files to "src/openonyx/render"
This commit is contained in:
1 parent
c05216e14f
commit
987d09b728
5 files changed
+738
No files matched your search
@@ -0,0 +1,4 @@
|
||||
package openonyx.render;
|
||||
|
||||
public record EntityProjectionData2(float left, float top, float width, float height, float topCenterX, float bottomCenterX) {
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package openonyx.render;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class FloatStack {
|
||||
private int size;
|
||||
private float[] values;
|
||||
|
||||
public float pop() {
|
||||
return this.size == 0 ? 1.0F : this.values[--this.size];
|
||||
}
|
||||
|
||||
public FloatStack() {
|
||||
int i = 63 & 80;
|
||||
super();
|
||||
float[] f = new float[i];
|
||||
boolean bl = true;
|
||||
this.values = f;
|
||||
}
|
||||
|
||||
public void push(float f) {
|
||||
if (this.size == this.values.length) {
|
||||
this.values = Arrays.copyOf(this.values, this.size * 2);
|
||||
}
|
||||
|
||||
this.values[this.size++] = f;
|
||||
}
|
||||
|
||||
public static String decrypt(String string) {
|
||||
String string1 = string;
|
||||
int k = (--3 ^ 5) << 3 ^ 3;
|
||||
String string2;
|
||||
int n = (string2 = string1).length();
|
||||
char[] e = new char[n];
|
||||
boolean bl = true;
|
||||
int i;
|
||||
int m = i = n - 1;
|
||||
char[] c = e;
|
||||
byte d = 46;
|
||||
k = m;
|
||||
byte b = 41;
|
||||
|
||||
while (k >= 0) {
|
||||
int l = i;
|
||||
int j = string2.charAt(i);
|
||||
i--;
|
||||
c[l] = (char)(j ^ b);
|
||||
if (i < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
j = i--;
|
||||
c[j] = (char)(string2.charAt(j) ^ d);
|
||||
k = i;
|
||||
}
|
||||
|
||||
return new String(c);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
package openonyx.render;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import openonyx.core.MinecraftAccess;
|
||||
import openonyx.core.OnyxClient;
|
||||
import openonyx.features.render.FogBlur;
|
||||
import openonyx.render.group_p.ShaderProgram;
|
||||
import openonyx.theme.ThemeManager;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public final class FogBlurShader implements MinecraftAccess {
|
||||
private static int J = -1;
|
||||
private static final int D = 5889;
|
||||
private static ShaderProgram shaderProgram;
|
||||
private static int a = -1;
|
||||
private static ShaderProgram shaderProgram2;
|
||||
private static final int g = 5888;
|
||||
private static int M = -1;
|
||||
private static int L;
|
||||
private static boolean j;
|
||||
private static int m = -1;
|
||||
private static ShaderProgram shaderProgram3;
|
||||
private static final int l = 2;
|
||||
private static int I = -1;
|
||||
private static final int d = 10496;
|
||||
private static int i = -1;
|
||||
private static final float f = 0.05F;
|
||||
private static boolean H = true;
|
||||
private static int e;
|
||||
|
||||
private static void D(int i, int j) {
|
||||
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit + ix);
|
||||
GlStateManager.bindTexture(jx);
|
||||
}
|
||||
|
||||
private static void h() {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glBegin(7);
|
||||
GL11.glTexCoord2f(0.0F, 0.0F);
|
||||
GL11.glVertex2f(0.0F, 0.0F);
|
||||
GL11.glTexCoord2f(1.0F, 0.0F);
|
||||
GL11.glVertex2f(1.0F, 0.0F);
|
||||
GL11.glTexCoord2f(1.0F, 1.0F);
|
||||
GL11.glVertex2f(1.0F, 1.0F);
|
||||
GL11.glTexCoord2f(0.0F, 1.0F);
|
||||
GL11.glVertex2f(0.0F, 1.0F);
|
||||
GL11.glEnd();
|
||||
}
|
||||
|
||||
private static void L(ShaderProgram shaderProgram, int i, int j, int k, int l, int m, int n) {
|
||||
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, jx);
|
||||
GlStateManager.viewport(0, 0, k, lx);
|
||||
D(0, ix);
|
||||
shaderProgramx.use();
|
||||
shaderProgramx.setUniform1i("Sampler0", 0);
|
||||
shaderProgramx.setUniform2f("uSourceSize", mx, n);
|
||||
h();
|
||||
}
|
||||
|
||||
private static void L(FogBlur fogBlur, float f, Framebuffer framebuffer, int i, int j) {
|
||||
if (framebuffer != null) {
|
||||
framebuffer.bindFramebuffer(false);
|
||||
} else {
|
||||
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
GlStateManager.viewport(0, 0, ix, jx);
|
||||
float gx = Math.max(1.05F, mc.gameSettings.renderDistanceChunks * 16.0F * 4.0F);
|
||||
shaderProgram3.use();
|
||||
shaderProgram3.setUniform1i("BlurSampler", 1);
|
||||
shaderProgram3.setUniform1i("DepthSampler", 2);
|
||||
shaderProgram3.setUniform4f("uCamera", 0.05F, gx, fx, 0.0F);
|
||||
shaderProgram3.setUniform4f(
|
||||
"uFog", fogBlur.distance.getFloat(), fogBlur.fade.getFloat(), fogBlur.tint.getFloat(), fogBlur.clientColor.isEnabled() ? 1.0F : 0.0F
|
||||
);
|
||||
int k = ThemeManager.getPalette().primary();
|
||||
int lx = ThemeManager.getPalette().tertiary();
|
||||
shaderProgram3.setUniformColor("uColor1", k);
|
||||
shaderProgram3.setUniformColor("uColor2", k);
|
||||
shaderProgram3.setUniformColor("uColor3", lx);
|
||||
shaderProgram3.setUniformColor("uColor4", lx);
|
||||
D(1, a);
|
||||
D(2, m);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 771);
|
||||
h();
|
||||
GlStateManager.disableBlend();
|
||||
D(2, 0);
|
||||
D(1, 0);
|
||||
D(0, 0);
|
||||
}
|
||||
|
||||
private static void L(int i) {
|
||||
int k = ix;
|
||||
int jx = Math.max(1, e / 2);
|
||||
ix = Math.max(1, L / 2);
|
||||
int lx = Math.max(1, jx / 2);
|
||||
int mx = Math.max(1, ix / 2);
|
||||
L(shaderProgram, k, i, jx, ix, e, L);
|
||||
L(shaderProgram, a, M, lx, mx, jx, ix);
|
||||
L(shaderProgram2, J, i, jx, ix, lx, mx);
|
||||
}
|
||||
|
||||
private static void I() {
|
||||
ShaderProgram.unbind();
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableFog();
|
||||
GlStateManager.enableLighting();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.resetColor();
|
||||
}
|
||||
|
||||
private static void i() {
|
||||
GL11.glTexParameteri(3553, 10241, 9729);
|
||||
GL11.glTexParameteri(3553, 10240, 9729);
|
||||
GL11.glTexParameteri(3553, 10242, 33071);
|
||||
GL11.glTexParameteri(3553, 10243, 33071);
|
||||
}
|
||||
|
||||
private static int L(int i) {
|
||||
int jx = ix;
|
||||
if ((ix = OpenGlHelper.glGenFramebuffers()) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, ix);
|
||||
OpenGlHelper.glFramebufferTexture2D(OpenGlHelper.GL_FRAMEBUFFER, OpenGlHelper.GL_COLOR_ATTACHMENT0, 3553, jx, 0);
|
||||
int k = OpenGlHelper.glCheckFramebufferStatus(OpenGlHelper.GL_FRAMEBUFFER);
|
||||
OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0);
|
||||
return k == OpenGlHelper.GL_FRAMEBUFFER_COMPLETE ? ix : -1;
|
||||
}
|
||||
|
||||
private static void d(int i, int j) {
|
||||
D(0, m);
|
||||
GL11.glCopyTexSubImage2D(3553, 0, 0, 0, 0, 0, ix, jx);
|
||||
}
|
||||
|
||||
private FogBlurShader() {
|
||||
}
|
||||
|
||||
private static void L(Framebuffer framebuffer, boolean bl) {
|
||||
if (bl) {
|
||||
D(0, framebuffer.framebufferTexture);
|
||||
L(framebuffer.framebufferFilter, 10496);
|
||||
D(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void D() {
|
||||
if (H && OnyxClient.moduleManager != null) {
|
||||
if (OpenGlHelper.shadersSupported) {
|
||||
FogBlur fogBlur = OnyxClient.moduleManager.fogBlur;
|
||||
Minecraft minecraft = MinecraftAccess.mc;
|
||||
if (fogBlur.isEnabled() && minecraft.theWorld != null) {
|
||||
float fx = fogBlur.disableOnZoom.isEnabled() ? 1.0F - Math.clamp(OnyxClient.moduleManager.zoom.L(), 0.0F, 1.0F) : 1.0F;
|
||||
if (!(fx <= 0.01F)) {
|
||||
Framebuffer framebuffer = minecraft.getFramebuffer();
|
||||
boolean bl = OpenGlHelper.isFramebufferEnabled() && framebuffer != null;
|
||||
int ix = bl ? framebuffer.framebufferWidth : minecraft.displayWidth;
|
||||
int jx = bl ? framebuffer.framebufferHeight : minecraft.displayHeight;
|
||||
if (ix > 0 && jx > 0) {
|
||||
if (!j) {
|
||||
j = true;
|
||||
shaderProgram = ShaderProgram.load("onyx_fog_down");
|
||||
shaderProgram2 = ShaderProgram.load("onyx_fog_up");
|
||||
shaderProgram3 = ShaderProgram.load("onyx_fog_composite");
|
||||
}
|
||||
|
||||
if (shaderProgram != null
|
||||
&& shaderProgram2 != null
|
||||
&& shaderProgram3 != null
|
||||
&& shaderProgram.isLoaded()
|
||||
&& shaderProgram2.isLoaded()
|
||||
&& shaderProgram3.isLoaded()) {
|
||||
try {
|
||||
L(ix, jx, bl);
|
||||
int k = L(framebuffer, bl, ix, jx);
|
||||
d(ix, jx);
|
||||
d();
|
||||
L(k);
|
||||
L(framebuffer, bl);
|
||||
Framebuffer framebuffer1;
|
||||
int lx;
|
||||
if (bl) {
|
||||
framebuffer1 = framebuffer;
|
||||
lx = ix;
|
||||
} else {
|
||||
framebuffer1 = null;
|
||||
lx = ix;
|
||||
}
|
||||
|
||||
L(fogBlur, fx, framebuffer1, lx, jx);
|
||||
I();
|
||||
} catch (Throwable throwable) {
|
||||
L(throwable);
|
||||
}
|
||||
} else {
|
||||
H = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int d(int i, int j) {
|
||||
int k = ix;
|
||||
GlStateManager.bindTexture(ix = TextureUtil.glGenTextures());
|
||||
GL11.glTexImage2D(3553, 0, 33190, k, jx, 0, 6402, 5126, (ByteBuffer)null);
|
||||
i();
|
||||
return ix;
|
||||
}
|
||||
|
||||
private static void L(Throwable throwable) {
|
||||
H = false;
|
||||
|
||||
try {
|
||||
L();
|
||||
} catch (Throwable throwable1) {
|
||||
}
|
||||
|
||||
OnyxClient.LOGGER.warn("Fog Blur failed, disabled for this session", throwable);
|
||||
}
|
||||
|
||||
private static void d() {
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GL11.glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableFog();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
|
||||
private static int L(Framebuffer framebuffer, boolean bl, int i, int j) {
|
||||
if (bl) {
|
||||
D(0, framebuffer.framebufferTexture);
|
||||
L(9729, 33071);
|
||||
return framebuffer.framebufferTexture;
|
||||
} else {
|
||||
D(0, I);
|
||||
GL11.glCopyTexSubImage2D(3553, 0, 0, 0, 0, 0, ix, jx);
|
||||
return I;
|
||||
}
|
||||
}
|
||||
|
||||
private static void L() {
|
||||
if (i != -1) {
|
||||
OpenGlHelper.glDeleteFramebuffers(i);
|
||||
i = -1;
|
||||
}
|
||||
|
||||
if (M != -1) {
|
||||
OpenGlHelper.glDeleteFramebuffers(M);
|
||||
M = -1;
|
||||
}
|
||||
|
||||
int[] n = new int[4];
|
||||
boolean bl = true;
|
||||
n[0] = I;
|
||||
n[1] = m;
|
||||
n[2] = a;
|
||||
n[3] = J;
|
||||
int[] ix = n;
|
||||
int jx = n.length;
|
||||
|
||||
int k;
|
||||
for (int mx = k = 0; mx < jx; mx = ++k) {
|
||||
int lx;
|
||||
if ((lx = ix[k]) != -1) {
|
||||
TextureUtil.deleteTexture(lx);
|
||||
}
|
||||
}
|
||||
|
||||
I = -1;
|
||||
m = -1;
|
||||
a = -1;
|
||||
J = -1;
|
||||
e = 0;
|
||||
L = 0;
|
||||
}
|
||||
|
||||
private static void L(int i, int j, boolean bl) {
|
||||
if (a == -1 || e != ix || L != jx || !bl && I == -1) {
|
||||
L();
|
||||
int k = Math.max(1, ix / 2);
|
||||
int lx = Math.max(1, jx / 2);
|
||||
int mx = Math.max(1, k / 2);
|
||||
int n = Math.max(1, lx / 2);
|
||||
if (!bl) {
|
||||
I = L(ix, jx);
|
||||
}
|
||||
|
||||
a = L(k, lx);
|
||||
J = L(mx, n);
|
||||
m = d(ix, jx);
|
||||
i = L(a);
|
||||
M = L(J);
|
||||
if (i != -1 && M != -1) {
|
||||
e = ix;
|
||||
L = jx;
|
||||
} else {
|
||||
throw new IllegalStateException("could not create fog blur render targets");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int L(int i, int j) {
|
||||
int k = ix;
|
||||
GlStateManager.bindTexture(ix = TextureUtil.glGenTextures());
|
||||
GL11.glTexImage2D(3553, 0, 32856, k, jx, 0, 6408, 5121, (ByteBuffer)null);
|
||||
i();
|
||||
return ix;
|
||||
}
|
||||
|
||||
private static void L(int i, int j) {
|
||||
GL11.glTexParameteri(3553, 10241, ix);
|
||||
GL11.glTexParameteri(3553, 10240, ix);
|
||||
GL11.glTexParameteri(3553, 10242, jx);
|
||||
GL11.glTexParameteri(3553, 10243, jx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package openonyx.render;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import net.minecraft.client.shader.Shader;
|
||||
import net.minecraft.client.shader.ShaderGroup;
|
||||
import net.minecraft.client.shader.ShaderManager;
|
||||
import net.minecraft.client.shader.ShaderUniform;
|
||||
import openonyx.features.render.GlowESP;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public final class GlowShader {
|
||||
private static final float M = 24.0F;
|
||||
private static final FloatBuffer FLOAT_BUFFER = BufferUtils.createFloatBuffer(4);
|
||||
private static final int j = 9729;
|
||||
private static final float m = 10000.0F;
|
||||
private static final float h = 4.0F;
|
||||
private static final float l = 2.0F;
|
||||
private static final float I = 0.1F;
|
||||
private static final float d = 6.0F;
|
||||
private static final long i = System.nanoTime();
|
||||
private static final float f = 1.0F;
|
||||
private static boolean H;
|
||||
private static final float e = 1.6F;
|
||||
|
||||
private static void L(ShaderManager shaderManager, String string, float f, float g, float h) {
|
||||
ShaderUniform shaderUniform;
|
||||
if ((shaderUniform = shaderManager.getShaderUniform(string)) != null) {
|
||||
shaderUniform.set(fx, g, hx);
|
||||
}
|
||||
}
|
||||
|
||||
private static void L(ShaderManager shaderManager, String string, float f, float g, float h, float i) {
|
||||
ShaderUniform shaderUniform;
|
||||
if ((shaderUniform = shaderManager.getShaderUniform(string)) != null) {
|
||||
shaderUniform.set(fx, g, hx, ix);
|
||||
}
|
||||
}
|
||||
|
||||
private GlowShader() {
|
||||
}
|
||||
|
||||
private static float D() {
|
||||
GlowESP glowESP;
|
||||
float fx = (glowESP = GlowESP.L()) == null ? 24.0F : Math.clamp(glowESP.radius.getFloat(), 2.0F, 24.0F);
|
||||
return fx * 1.6F + 6.0F;
|
||||
}
|
||||
|
||||
public static boolean L() {
|
||||
return H;
|
||||
}
|
||||
|
||||
public static float d() {
|
||||
GlowESP glowESP;
|
||||
return (glowESP = GlowESP.L()) != null && glowESP.h() ? 4.0F : D();
|
||||
}
|
||||
|
||||
public static void L() {
|
||||
H = false;
|
||||
GL11.glTexEnvi(8960, 8704, 8448);
|
||||
}
|
||||
|
||||
private static void L(ShaderGroup shaderGroup, float f, float g) {
|
||||
ShaderGroup shaderGroup1 = shaderGroup;
|
||||
float ix = Math.max(1, Minecraft.getMinecraft().displayWidth);
|
||||
float hx = fx * 1.6F + 6.0F;
|
||||
List list = shaderGroup1.getListShaders();
|
||||
|
||||
for (int lx = k = 0; lx < list.size(); lx = ++k) {
|
||||
Shader shader = (Shader)list.get(k);
|
||||
ShaderManager shaderManager = shader.getShaderManager();
|
||||
float jx = shader.framebufferIn.framebufferTextureWidth / ix;
|
||||
L(shaderManager, "Radius", Math.max(1.0F, fx * jx));
|
||||
L(shaderManager, "Intensity", g);
|
||||
RenderSupport_133.L(shader, k == 0 ? hx * 2.0F : hx);
|
||||
}
|
||||
|
||||
L(shaderGroup1, "final");
|
||||
L(shaderGroup1, "blurx");
|
||||
L(shaderGroup1, "halo");
|
||||
}
|
||||
|
||||
public static float L() {
|
||||
GlowESP glowESP;
|
||||
return (glowESP = GlowESP.L()) != null && glowESP.h() ? 8.0F : 3.0F * D();
|
||||
}
|
||||
|
||||
public static void L(int i) {
|
||||
H = true;
|
||||
FLOAT_BUFFER.clear();
|
||||
FLOAT_BUFFER.put((ix >> 16 & 0xFF) / 255.0F).put((ix >> 8 & 0xFF) / 255.0F).put((ix & 0xFF) / 255.0F).put(1.0F);
|
||||
FLOAT_BUFFER.flip();
|
||||
GL11.glTexEnv(8960, 8705, FLOAT_BUFFER);
|
||||
GL11.glTexEnvi(8960, 8704, 34160);
|
||||
GL11.glTexEnvi(8960, 34161, 7681);
|
||||
GL11.glTexEnvi(8960, 34176, 34166);
|
||||
GL11.glTexEnvi(8960, 34192, 768);
|
||||
GL11.glTexEnvi(8960, 34162, 8448);
|
||||
GL11.glTexEnvi(8960, 34184, 5890);
|
||||
GL11.glTexEnvi(8960, 34200, 770);
|
||||
GL11.glTexEnvi(8960, 34185, 34167);
|
||||
GL11.glTexEnvi(8960, 34201, 770);
|
||||
}
|
||||
|
||||
private static void L(ShaderGroup shaderGroup, float f) {
|
||||
ShaderGroup shaderGroup1 = shaderGroup;
|
||||
float g = (float)(System.nanoTime() - i) / 1.0E9F % 10000.0F;
|
||||
|
||||
for (Iterator iterator1 = iterator = shaderGroup1.getListShaders().iterator(); iterator1.hasNext(); iterator1 = iterator) {
|
||||
Shader shader = (Shader)iterator.next();
|
||||
ShaderManager shaderManager = shader.getShaderManager();
|
||||
L(shaderManager, "BaseColor", 0.0F, 0.0F, 0.0F, fx);
|
||||
L(shaderManager, "EffectData", g, 0.0F, 0.0F, 0.0F);
|
||||
RenderSupport_133.L(shader, 4.0F);
|
||||
}
|
||||
}
|
||||
|
||||
private static void L(ShaderGroup shaderGroup, String string) {
|
||||
Framebuffer framebuffer;
|
||||
if ((framebuffer = shaderGroup.getFramebufferRaw(string)) != null && framebuffer.framebufferFilter != 9729) {
|
||||
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
framebuffer.setFramebufferFilter(9729);
|
||||
}
|
||||
}
|
||||
|
||||
private static void L(ShaderManager shaderManager, String string, float f) {
|
||||
ShaderUniform shaderUniform;
|
||||
if ((shaderUniform = shaderManager.getShaderUniform(string)) != null) {
|
||||
shaderUniform.set(fx);
|
||||
}
|
||||
}
|
||||
|
||||
public static void L(ShaderGroup shaderGroup) {
|
||||
ShaderGroup shaderGroup1 = shaderGroup;
|
||||
GlowESP glowESP = GlowESP.L();
|
||||
if (shaderGroup1 != null && glowESP != null && glowESP.isEnabled()) {
|
||||
float fx = Math.clamp(glowESP.intensity.getFloat() / 100.0F, 0.1F, 1.0F);
|
||||
if (glowESP.h()) {
|
||||
L(shaderGroup1, fx);
|
||||
} else {
|
||||
L(shaderGroup1, Math.clamp(glowESP.radius.getFloat(), 2.0F, 24.0F), fx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package openonyx.render;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import openonyx.core.MinecraftAccess;
|
||||
import openonyx.core.OnyxClient;
|
||||
import openonyx.features.render.GlintEffect;
|
||||
import openonyx.features.render.Hand;
|
||||
import openonyx.features.render.SmokeEffect;
|
||||
import openonyx.render.group_p.ShaderProgram;
|
||||
import openonyx.theme.internal.ColorUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public final class HandMaskShader implements MinecraftAccess {
|
||||
private static final int j = 5889;
|
||||
private static boolean m;
|
||||
private static boolean h;
|
||||
private static int l;
|
||||
private static ShaderProgram shaderProgram;
|
||||
private static final int d = 5888;
|
||||
private static final RenderTarget RENDER_TARGET = new RenderTarget(true);
|
||||
private static boolean f;
|
||||
private static int H;
|
||||
private static boolean e = true;
|
||||
|
||||
private HandMaskShader() {
|
||||
}
|
||||
|
||||
private static void L(ItemRenderer itemRenderer, float f, Framebuffer framebuffer, float g, int i, GlintEffect glintEffect) {
|
||||
RENDER_TARGET.resize(Math.round(H * g), Math.round(l * g));
|
||||
if (glintEffect != null) {
|
||||
ScissorStack.L(MaskedBlurShader.d(glintEffect, (float)RENDER_TARGET.getWidth() / H), RENDER_TARGET.getWidth(), RENDER_TARGET.getHeight());
|
||||
}
|
||||
|
||||
RENDER_TARGET.bindAndClear();
|
||||
shaderProgram.use();
|
||||
shaderProgram.setUniform1i("Sampler0", 0);
|
||||
shaderProgram.setUniform4f("uColor", ColorUtils.red(i) / 255.0F, ColorUtils.green(i) / 255.0F, ColorUtils.blue(i) / 255.0F, 1.0F);
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.pushMatrix();
|
||||
h = true;
|
||||
|
||||
try {
|
||||
itemRenderer.renderItemInFirstPerson(fx);
|
||||
} finally {
|
||||
h = false;
|
||||
}
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
ShaderProgram.unbind();
|
||||
ScissorStack.d();
|
||||
framebuffer.bindFramebuffer(false);
|
||||
GlStateManager.viewport(0, 0, H, l);
|
||||
}
|
||||
|
||||
public static boolean L() {
|
||||
return h;
|
||||
}
|
||||
|
||||
public static void L(Framebuffer framebuffer) {
|
||||
ShaderProgram.unbind();
|
||||
L(2, 0);
|
||||
L(1, 0);
|
||||
L(0, 0);
|
||||
framebuffer.bindFramebuffer(false);
|
||||
GlStateManager.viewport(0, 0, H, l);
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.resetColor();
|
||||
}
|
||||
|
||||
public static void L(int i, int j) {
|
||||
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit + i);
|
||||
GlStateManager.bindTexture(jx);
|
||||
}
|
||||
|
||||
public static void d() {
|
||||
GlStateManager.matrixMode(5889);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GL11.glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
|
||||
GlStateManager.matrixMode(5888);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.loadIdentity();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableDepth();
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.disableFog();
|
||||
GlStateManager.enableTexture2D();
|
||||
}
|
||||
|
||||
static void L(Throwable throwable) {
|
||||
e = false;
|
||||
ScissorStack.d();
|
||||
RENDER_TARGET.delete();
|
||||
MaskedBlurShader.L();
|
||||
TrailShader.L();
|
||||
if (!f) {
|
||||
f = true;
|
||||
OnyxClient.LOGGER.warn("Hand effects have been disabled after a render failure", throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public static void L(ItemRenderer itemRenderer, float f) {
|
||||
ItemRenderer itemRenderer1 = itemRenderer;
|
||||
if (e && OnyxClient.moduleManager != null) {
|
||||
if (OpenGlHelper.shadersSupported) {
|
||||
Hand hand = OnyxClient.moduleManager.hand;
|
||||
GlintEffect glintEffect;
|
||||
SmokeEffect smokeEffect = (glintEffect = OnyxClient.moduleManager.hand.L()) == null ? hand.L() : null;
|
||||
if (glintEffect == null && smokeEffect == null) {
|
||||
TrailShader.L();
|
||||
} else {
|
||||
Framebuffer framebuffer = MinecraftAccess.mc.getFramebuffer();
|
||||
if (OpenGlHelper.isFramebufferEnabled() && framebuffer != null) {
|
||||
H = framebuffer.framebufferWidth;
|
||||
l = framebuffer.framebufferHeight;
|
||||
if (H > 0 && l > 0) {
|
||||
try {
|
||||
if (!m) {
|
||||
m = true;
|
||||
shaderProgram = ShaderProgram.load("onyx_hand_mask");
|
||||
}
|
||||
|
||||
if (shaderProgram != null && shaderProgram.isLoaded()) {
|
||||
float g = glintEffect != null ? hand.L() : smokeEffect.L();
|
||||
int i;
|
||||
GlintEffect glintEffect1;
|
||||
if (glintEffect != null) {
|
||||
i = glintEffect.color.getOpaque();
|
||||
glintEffect1 = glintEffect;
|
||||
} else {
|
||||
i = -1;
|
||||
glintEffect1 = glintEffect;
|
||||
}
|
||||
|
||||
L(itemRenderer1, fx, framebuffer, g, i, glintEffect1);
|
||||
if (glintEffect != null) {
|
||||
MaskedBlurShader.L(RENDER_TARGET, framebuffer, glintEffect, H, l);
|
||||
} else {
|
||||
TrailShader.L(RENDER_TARGET, framebuffer, smokeEffect, hand.L(), hand.getItemColorWeight(), H, l, fx);
|
||||
}
|
||||
} else {
|
||||
e = false;
|
||||
}
|
||||
} catch (Throwable throwable) {
|
||||
L(throwable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void L() {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glBegin(7);
|
||||
GL11.glTexCoord2f(0.0F, 0.0F);
|
||||
GL11.glVertex2f(0.0F, 0.0F);
|
||||
GL11.glTexCoord2f(1.0F, 0.0F);
|
||||
GL11.glVertex2f(1.0F, 0.0F);
|
||||
GL11.glTexCoord2f(1.0F, 1.0F);
|
||||
GL11.glVertex2f(1.0F, 1.0F);
|
||||
GL11.glTexCoord2f(0.0F, 1.0F);
|
||||
GL11.glVertex2f(0.0F, 1.0F);
|
||||
GL11.glEnd();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user