Upload files to "src/openonyx/render"
This commit is contained in:
1 parent
987d09b728
commit
9ef3eaaf4f
5 files changed
+748
No files matched your search
@@ -0,0 +1,328 @@
|
||||
package openonyx.render;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiChat;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import openonyx.core.MinecraftAccess;
|
||||
import openonyx.core.OnyxClient;
|
||||
import openonyx.features.render.Hand;
|
||||
import openonyx.features.render.HandPose;
|
||||
import openonyx.history.internal.NumberSetting;
|
||||
import openonyx.render.group_d.Animation;
|
||||
import openonyx.render.group_d.Easings;
|
||||
import openonyx.theme.Fonts;
|
||||
import openonyx.theme.Palette;
|
||||
import openonyx.theme.ThemeManager;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.vector.Matrix4f;
|
||||
import org.lwjgl.util.vector.Vector4f;
|
||||
|
||||
public final class HandTransform implements MinecraftAccess {
|
||||
private static final float y = 0.07F;
|
||||
private static final float n = 0.03F;
|
||||
private static final Matrix4f MATRIX4F = new Matrix4f();
|
||||
private static boolean r;
|
||||
private static float W;
|
||||
private static float P;
|
||||
private static final float V = 70.0F;
|
||||
private static float R;
|
||||
private static boolean p;
|
||||
private static final Animation ANIMATION = new Animation(0.0F);
|
||||
private static float b;
|
||||
private static float E;
|
||||
private static final float F = 0.08F;
|
||||
private static final Animation ANIMATION2 = new Animation(0.0F);
|
||||
private static final float A = 1.05F;
|
||||
private static float K;
|
||||
private static long B;
|
||||
private static boolean C;
|
||||
private static final FloatBuffer FLOAT_BUFFER = BufferUtils.createFloatBuffer(16);
|
||||
private static final Animation ANIMATION3 = new Animation(0.0F);
|
||||
private static final float c = 0.05F;
|
||||
private static float a = 1.0F;
|
||||
private static boolean k;
|
||||
private static final float g = 55.0F;
|
||||
private static final float M = 70.0F;
|
||||
private static final float L = 22.0F;
|
||||
private static boolean j;
|
||||
private static float m;
|
||||
private static float h;
|
||||
private static final float l = 14.0F;
|
||||
private static final float I = 72.0F;
|
||||
private static boolean d;
|
||||
private static final float i = 30.0F;
|
||||
private static float f;
|
||||
private static final Matrix4f MATRIX4F2 = new Matrix4f();
|
||||
private static float e;
|
||||
|
||||
private static float d() {
|
||||
long lx = System.nanoTime();
|
||||
long mx = B;
|
||||
B = lx;
|
||||
return mx == 0L ? 0.0F : Math.min((float)(lx - mx) / 1000000.0F, 100.0F);
|
||||
}
|
||||
|
||||
private HandTransform() {
|
||||
}
|
||||
|
||||
private static HandTransformData L() {
|
||||
if (OnyxClient.moduleManager != null && mc.thePlayer != null) {
|
||||
Hand hand = OnyxClient.moduleManager.hand;
|
||||
if (!OnyxClient.moduleManager.hand.isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
HandPose handPose = hand.mainHand;
|
||||
return new HandTransformData(handPose.positionX, handPose.positionY, handPose.positionZ, handPose.scaleX, handPose.scaleY, handPose.scaleZ);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean L(double d) {
|
||||
if (!C && !p) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HandTransformData handTransformData;
|
||||
if ((handTransformData = L()) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
if (handTransformData.d()) {
|
||||
handTransformData.z.setValue(handTransformData.z.getValue() + dx * 0.03F);
|
||||
}
|
||||
} else if (handTransformData.L()) {
|
||||
double ex = Math.pow(1.05F, dx);
|
||||
L(handTransformData.sx(), ex, dx);
|
||||
L(handTransformData.sy(), ex, dx);
|
||||
L(handTransformData.sz(), ex, dx);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void L(Render2D render2D, Palette palette, float f, float g) {
|
||||
Render2D render2D1 = render2D;
|
||||
float hx;
|
||||
if (!((hx = ANIMATION.getValue()) <= 0.01F)) {
|
||||
HandTransformData handTransformData;
|
||||
if ((handTransformData = L()) != null) {
|
||||
float kx = L(gx);
|
||||
fx = fx / 2.0F + f / kx;
|
||||
gx = gx / 2.0F - W / kx - 30.0F;
|
||||
float lx = ANIMATION2.getValue();
|
||||
float ix = 14.0F + 4.0F * lx;
|
||||
int jx = palette.primary();
|
||||
render2D1.pushAlpha(hx);
|
||||
render2D1.circle(fx, gx, ix, ThemeManager.withAlpha(jx, 0.05F + 0.13F * lx));
|
||||
render2D1.L(fx, gx, ix, 1.5F, ThemeManager.withAlpha(jx, 0.4F + 0.5F * lx));
|
||||
render2D1.circle(fx, gx, 1.5F + lx, ThemeManager.withAlpha(jx, 0.6F + 0.4F * lx));
|
||||
if (lx > 0.01F) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (handTransformData.d()) {
|
||||
Locale locale1 = Locale.ROOT;
|
||||
Object[] objects1 = new Object[3];
|
||||
boolean bl1 = true;
|
||||
objects1[0] = handTransformData.x.getValue();
|
||||
objects1[1] = handTransformData.y.getValue();
|
||||
objects1[2] = handTransformData.z.getValue();
|
||||
stringBuilder.append(String.format(locale1, "%.2f %.2f %.2f", objects1));
|
||||
}
|
||||
|
||||
if (handTransformData.L()) {
|
||||
if (stringBuilder.length() > 0) {
|
||||
stringBuilder.append(" ");
|
||||
}
|
||||
|
||||
Locale locale = Locale.ROOT;
|
||||
Object[] objects = new Object[1];
|
||||
boolean bl = true;
|
||||
objects[0] = handTransformData.sy.getValue();
|
||||
stringBuilder.append(String.format(locale, "x%.2f", objects));
|
||||
}
|
||||
|
||||
String string = stringBuilder.toString();
|
||||
float mx = render2D1.getTextWidth(Fonts.FONT_STYLE11, string) + 14.0F;
|
||||
gx = gx + ix + 7.0F;
|
||||
render2D1.pushAlpha(lx);
|
||||
render2D1.roundedRect(fx - mx / 2.0F, gx, mx, 17.0F, 8.5F, palette.surfaceContainerHigh());
|
||||
render2D1.drawTextCenteredVCentered(Fonts.FONT_STYLE11, string, fx, gx + 8.5F, palette.onSurface());
|
||||
render2D1.popAlpha();
|
||||
}
|
||||
|
||||
render2D1.popAlpha();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void L(float f, boolean bl) {
|
||||
float gx = fx;
|
||||
fx = (float)Math.exp(-gx / 70.0F);
|
||||
bl = bl && d && r && L() != null;
|
||||
ANIMATION.animateTo(bl ? 1.0F : 0.0F, 200.0F, Easings.EASING6);
|
||||
ANIMATION.update(gx);
|
||||
ANIMATION2.animateTo(j ? 1.0F : 0.0F, 150.0F, Easings.EASING6);
|
||||
ANIMATION2.update(gx);
|
||||
ANIMATION3.animateTo(p ? 1.0F : 0.0F, p ? 250.0F : 200.0F, p ? Easings.EASING7 : Easings.EASING6);
|
||||
ANIMATION3.update(gx);
|
||||
if (!p) {
|
||||
R *= fx;
|
||||
h *= fx;
|
||||
b *= fx;
|
||||
}
|
||||
}
|
||||
|
||||
private static void L(float f, float g, float h) {
|
||||
float ix = fx;
|
||||
HandTransformData handTransformData;
|
||||
if ((handTransformData = L()) != null && handTransformData.d()) {
|
||||
float jx = L(a);
|
||||
K = L(K + (ix - m) * jx, handTransformData.x);
|
||||
e = L(e - (gx - P) * jx, handTransformData.y);
|
||||
m = ix;
|
||||
P = gx;
|
||||
gx = 1.0F - (float)Math.exp(-hx / 55.0F);
|
||||
R = L(handTransformData.x, R, K, gx);
|
||||
h = L(handTransformData.y, h, e, gx);
|
||||
} else {
|
||||
p = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean d() {
|
||||
if (!(mc.currentScreen instanceof GuiChat)) {
|
||||
return false;
|
||||
} else if (mc.thePlayer == null) {
|
||||
return false;
|
||||
} else if (mc.gameSettings.thirdPersonView != 0) {
|
||||
return false;
|
||||
} else {
|
||||
return OnyxClient.moduleManager == null ? false : OnyxClient.moduleManager.hand.isEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
public static void D() {
|
||||
d = true;
|
||||
float fx = ANIMATION3.getValue();
|
||||
GlStateManager.translate(R, h + 0.05F * fx, b + 0.07F * fx);
|
||||
}
|
||||
|
||||
public static void d() {
|
||||
Matrix4f.invert(L(MATRIX4F2), MATRIX4F);
|
||||
r = false;
|
||||
d = false;
|
||||
}
|
||||
|
||||
public static boolean L() {
|
||||
return d() && OnyxClient.moduleManager != null && L() != null;
|
||||
}
|
||||
|
||||
private static void L(NumberSetting numberSetting, double d, double e) {
|
||||
double fx;
|
||||
if (Math.abs((dx = (fx = numberSetting.getValue()) * dx) - fx) < numberSetting.getStep()) {
|
||||
dx = fx + Math.signum(ex) * numberSetting.getStep();
|
||||
}
|
||||
|
||||
numberSetting.setValue(dx);
|
||||
}
|
||||
|
||||
public static float L() {
|
||||
return 1.0F + 0.08F * ANIMATION3.getValue();
|
||||
}
|
||||
|
||||
private static float L(float f) {
|
||||
float gx = fx;
|
||||
fx = Math.max(0.1F, -E);
|
||||
return (float)(2.0 * fx * Math.tan(Math.toRadians(35.0)) / gx);
|
||||
}
|
||||
|
||||
public static void L(Render2D render2D, float f, float g) {
|
||||
Render2D render2D1 = render2D;
|
||||
float ix = d();
|
||||
boolean bl = d();
|
||||
a = Math.max(1.0F, gx);
|
||||
float jx = Minecraft.getScaledMouseX() * fx / mc.displayWidth;
|
||||
float hx = gx - Minecraft.getScaledMouseY() * gx / mc.displayHeight - 1.0F;
|
||||
boolean bl1 = Mouse.isButtonDown(0);
|
||||
boolean bl2;
|
||||
if (bl && bl1) {
|
||||
HandTransformData handTransformData;
|
||||
if (!k && !p && L(jx, hx, fx, gx, 22.0F) && (handTransformData = L()) != null) {
|
||||
p = true;
|
||||
m = jx;
|
||||
P = hx;
|
||||
K = handTransformData.x.getFloat();
|
||||
e = handTransformData.y.getFloat();
|
||||
}
|
||||
|
||||
bl2 = bl1;
|
||||
} else {
|
||||
p = false;
|
||||
bl2 = bl1;
|
||||
}
|
||||
|
||||
k = bl2;
|
||||
j = bl && (p || L(jx, hx, fx, gx, 22.0F));
|
||||
C = bl && (p || L(jx, hx, fx, gx, 72.0F));
|
||||
if (p) {
|
||||
L(jx, hx, ix);
|
||||
}
|
||||
|
||||
L(ix, bl);
|
||||
if (bl) {
|
||||
L(render2D1, ThemeManager.getPalette(), fx, gx);
|
||||
if (j) {
|
||||
render2D1.usePointerCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean L(float f, float g, float h, float i, float j) {
|
||||
float kx = fx;
|
||||
if (d && r && L() != null) {
|
||||
fx = L(ix);
|
||||
hx = hx / 2.0F + f / fx - kx;
|
||||
gx = ix / 2.0F - W / fx - 30.0F - gx;
|
||||
return hx * hx + gx * gx < jx * jx;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static Matrix4f L(Matrix4f matrix4f) {
|
||||
FLOAT_BUFFER.clear();
|
||||
GL11.glGetFloat(2982, FLOAT_BUFFER);
|
||||
FLOAT_BUFFER.rewind();
|
||||
matrix4f.load(FLOAT_BUFFER);
|
||||
return matrix4f;
|
||||
}
|
||||
|
||||
public static void L() {
|
||||
if (OnyxClient.moduleManager != null) {
|
||||
Vector4f vector4f = Matrix4f.transform(L(MATRIX4F2), new Vector4f(0.0F, 0.0F, 0.0F, 1.0F), null);
|
||||
Vector4f vector4f1 = Matrix4f.transform(MATRIX4F, vector4f, null);
|
||||
f = vector4f1.x;
|
||||
W = vector4f1.y;
|
||||
E = vector4f1.z;
|
||||
r = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static float L(float f, NumberSetting numberSetting) {
|
||||
return Math.clamp(fx, (float)numberSetting.getMin(), (float)numberSetting.getMax());
|
||||
}
|
||||
|
||||
private static float L(NumberSetting numberSetting, float f, float g, float h) {
|
||||
fx = numberSetting.getFloat() + fx;
|
||||
float ix;
|
||||
numberSetting.setValue((double)(ix = fx + (gx - fx) * hx));
|
||||
return ix - numberSetting.getFloat();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package openonyx.render;
|
||||
|
||||
import openonyx.history.internal.NumberSetting;
|
||||
|
||||
record HandTransformData(NumberSetting x, NumberSetting y, NumberSetting z, NumberSetting sx, NumberSetting sy, NumberSetting sz) {
|
||||
public boolean d() {
|
||||
return this.x != null && this.y != null && this.z != null;
|
||||
}
|
||||
|
||||
public boolean L() {
|
||||
return this.sx != null && this.sy != null && this.sz != null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package openonyx.render;
|
||||
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.Vec3;
|
||||
import openonyx.core.MinecraftAccess;
|
||||
import openonyx.theme.internal.ColorUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public final class LineRenderer3D implements MinecraftAccess {
|
||||
private static Vec3 vec3 = new Vec3(0.0, 0.0, 0.0);
|
||||
private static boolean H;
|
||||
private static boolean e;
|
||||
|
||||
public static void d(Vec3 vec3, Vec3 vec31, int i, int j) {
|
||||
Vec3 vec32 = vec3x;
|
||||
if (H) {
|
||||
WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer();
|
||||
L(worldRenderer, vec32, i);
|
||||
L(worldRenderer, vec31, j);
|
||||
}
|
||||
}
|
||||
|
||||
public static void D() {
|
||||
if (H) {
|
||||
H = false;
|
||||
Tessellator.getInstance().draw();
|
||||
}
|
||||
}
|
||||
|
||||
public static void L(List<Vec3> list, int i, int j) {
|
||||
List list1 = list;
|
||||
if (e && list1.size() >= 2) {
|
||||
Tessellator tessellator;
|
||||
WorldRenderer worldRenderer = (tessellator = Tessellator.getInstance()).getWorldRenderer();
|
||||
worldRenderer.begin(3, DefaultVertexFormats.POSITION_COLOR);
|
||||
int k = list1.size() - 1;
|
||||
|
||||
for (int m = l = 0; m <= k; m = l) {
|
||||
Vec3 vec3x = (Vec3)list1.get(l);
|
||||
float f = l;
|
||||
float g = k;
|
||||
l++;
|
||||
L(worldRenderer, vec3x, L(i, j, f / g));
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
|
||||
private static int d(int i, int j, float f) {
|
||||
return Math.round(i + (j - i) * f);
|
||||
}
|
||||
|
||||
public static void L(Vec3 vec3, float f, int i) {
|
||||
Vec3 vec31 = vec3x;
|
||||
if (e) {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer worldRenderer = tessellator.getWorldRenderer();
|
||||
GL11.glPointSize(f);
|
||||
GL11.glEnable(2832);
|
||||
worldRenderer.begin(0, DefaultVertexFormats.POSITION_COLOR);
|
||||
L(worldRenderer, vec31, i);
|
||||
tessellator.draw();
|
||||
GL11.glDisable(2832);
|
||||
GL11.glPointSize(1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
private static int L(int i, int j, float f) {
|
||||
return i == j
|
||||
? i
|
||||
: ColorUtils.argb(
|
||||
d(ColorUtils.alpha(i), ColorUtils.alpha(j), f),
|
||||
d(ColorUtils.red(i), ColorUtils.red(j), f),
|
||||
d(ColorUtils.green(i), ColorUtils.green(j), f),
|
||||
d(ColorUtils.blue(i), ColorUtils.blue(j), f)
|
||||
);
|
||||
}
|
||||
|
||||
private LineRenderer3D() {
|
||||
}
|
||||
|
||||
public static void L(Vec3 vec3, Vec3 vec31, int i, int j) {
|
||||
if (e) {
|
||||
L();
|
||||
d(vec3x, vec31, i, j);
|
||||
D();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean L(float f, boolean bl, float g) {
|
||||
float h = f;
|
||||
Entity entity;
|
||||
if ((entity = mc.getRenderViewEntity()) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
vec3 = new Vec3(
|
||||
entity.prevPosX + (entity.posX - entity.prevPosX) * h,
|
||||
entity.prevPosY + (entity.posY - entity.prevPosY) * h,
|
||||
entity.prevPosZ + (entity.posZ - entity.prevPosZ) * h
|
||||
);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableTexture2D();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
||||
GlStateManager.disableCull();
|
||||
GlStateManager.depthMask(false);
|
||||
GlStateManager.shadeModel(7425);
|
||||
if (bl) {
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
|
||||
GL11.glEnable(2848);
|
||||
GL11.glHint(3154, 4354);
|
||||
GL11.glLineWidth(g);
|
||||
e = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void L(WorldRenderer worldRenderer, Vec3 vec3, int i) {
|
||||
worldRenderer.pos(vec3x.xCoord - vec3.xCoord, vec3x.yCoord - vec3.yCoord, vec3x.zCoord - vec3.zCoord)
|
||||
.color(ColorUtils.red(i), ColorUtils.green(i), ColorUtils.blue(i), ColorUtils.alpha(i))
|
||||
.endVertex();
|
||||
}
|
||||
|
||||
public static void d() {
|
||||
if (e) {
|
||||
D();
|
||||
e = false;
|
||||
GL11.glDisable(2848);
|
||||
GL11.glLineWidth(1.0F);
|
||||
GlStateManager.shadeModel(7424);
|
||||
GlStateManager.depthMask(true);
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableTexture2D();
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
public static void L() {
|
||||
if (e && !H) {
|
||||
Tessellator.getInstance().getWorldRenderer().begin(1, DefaultVertexFormats.POSITION_COLOR);
|
||||
H = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package openonyx.render;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.shader.Framebuffer;
|
||||
import openonyx.features.render.GlintEffect;
|
||||
import openonyx.render.group_p.ShaderProgram;
|
||||
import openonyx.theme.internal.ColorUtils;
|
||||
|
||||
public final class MaskedBlurShader {
|
||||
private static final RenderTarget RENDER_TARGET = new RenderTarget(false);
|
||||
private static ShaderProgram shaderProgram;
|
||||
private static final RenderTarget RENDER_TARGET2 = new RenderTarget(false);
|
||||
private static final long D = 3600000000000L;
|
||||
private static final float c = 0.9F;
|
||||
private static final float a = 2.0F;
|
||||
private static final float k = 16.0F;
|
||||
private static final RenderTarget RENDER_TARGET3 = new RenderTarget(false);
|
||||
private static final RenderTarget RENDER_TARGET4 = new RenderTarget(false);
|
||||
private static final float L = 0.05F;
|
||||
private static final float j = 2.2F;
|
||||
private static ShaderProgram shaderProgram2;
|
||||
private static ShaderProgram shaderProgram3;
|
||||
private static final RenderTarget RENDER_TARGET5 = new RenderTarget(false);
|
||||
private static final long I = System.nanoTime();
|
||||
private static final float d = 4.0F;
|
||||
private static ShaderProgram shaderProgram4;
|
||||
private static final float f = 24.0F;
|
||||
private static final float H = 8.0F;
|
||||
private static boolean e;
|
||||
|
||||
static float d(GlintEffect glintEffect, float f) {
|
||||
GlintEffect glintEffect1 = glintEffect;
|
||||
float g = glintEffect1.padding.getFloat() * fx;
|
||||
float h = glintEffect1.smoothing.getFloat() * fx;
|
||||
return L(g, h) + L(g, h, L(glintEffect1, fx));
|
||||
}
|
||||
|
||||
private static float L(GlintEffect glintEffect, float f) {
|
||||
return Math.min(8.0F, glintEffect.outline.getFloat() * fx);
|
||||
}
|
||||
|
||||
private static float d(float f) {
|
||||
return fx < 0.05F ? 0.0F : 2.0F * Math.clamp((float)Math.ceil(fx * 0.5F), 1.0F, 16.0F);
|
||||
}
|
||||
|
||||
static void L() {
|
||||
RENDER_TARGET5.delete();
|
||||
RENDER_TARGET2.delete();
|
||||
RENDER_TARGET.delete();
|
||||
RENDER_TARGET4.delete();
|
||||
RENDER_TARGET3.delete();
|
||||
}
|
||||
|
||||
private static void d(RenderTarget renderTarget, RenderTarget renderTarget1, float f, float g, float h) {
|
||||
renderTarget1.bind();
|
||||
HandMaskShader.L(0, renderTarget.getTexture());
|
||||
shaderProgram4.use();
|
||||
shaderProgram4.setUniform1i("Sampler0", 0);
|
||||
shaderProgram4.setUniform2f("uSourceSize", renderTarget.getWidth(), renderTarget.getHeight());
|
||||
shaderProgram4.setUniform2f("uDirection", fx, g);
|
||||
shaderProgram4.setUniform1f("uPadding", h);
|
||||
HandMaskShader.L();
|
||||
}
|
||||
|
||||
private static void L(RenderTarget renderTarget, RenderTarget renderTarget1, float f, float g, float h) {
|
||||
renderTarget1.bind();
|
||||
HandMaskShader.L(0, renderTarget.getTexture());
|
||||
shaderProgram.use();
|
||||
shaderProgram.setUniform1i("Sampler0", 0);
|
||||
shaderProgram.setUniform2f("uSourceSize", renderTarget.getWidth(), renderTarget.getHeight());
|
||||
shaderProgram.setUniform2f("uDirection", fx, g);
|
||||
shaderProgram.setUniform1f("uRadius", h);
|
||||
HandMaskShader.L();
|
||||
}
|
||||
|
||||
private static void L(RenderTarget renderTarget, RenderTarget renderTarget1, GlintEffect glintEffect, float f, int i, int j) {
|
||||
renderTarget1.bind();
|
||||
HandMaskShader.L(0, renderTarget.getTexture());
|
||||
int l = glintEffect.color.getOpaque();
|
||||
int kx = glintEffect.color2.getOpaque();
|
||||
float g = glintEffect.alpha.getFloat() / 100.0F;
|
||||
shaderProgram3.use();
|
||||
shaderProgram3.setUniform1i("Sampler0", 0);
|
||||
shaderProgram3.setUniform2f("uMaskSize", renderTarget.getWidth(), renderTarget.getHeight());
|
||||
shaderProgram3.setUniform2f("uOutSize", i, jx);
|
||||
shaderProgram3.setUniform4f("uColorPrimary", ColorUtils.red(l) / 255.0F, ColorUtils.green(l) / 255.0F, ColorUtils.blue(l) / 255.0F, g);
|
||||
shaderProgram3.setUniform4f(
|
||||
"uColorSecondary", ColorUtils.red(kx) / 255.0F, ColorUtils.green(kx) / 255.0F, ColorUtils.blue(kx) / 255.0F, glintEffect.fill.getFloat() / 100.0F
|
||||
);
|
||||
shaderProgram3.setUniform4f("uMotion", L(), glintEffect.speed.getFloat(), 2.0F, L(glintEffect, fx));
|
||||
shaderProgram3.setUniform4f("uOptions", glintEffect.glow.getFloat() / 100.0F, glintEffect.outlineOnly.isEnabled() ? 1.0F : 0.0F, 0.0F, 0.0F);
|
||||
HandMaskShader.L();
|
||||
}
|
||||
|
||||
private static boolean L() {
|
||||
if (!e) {
|
||||
e = true;
|
||||
shaderProgram4 = ShaderProgram.load("onyx_hand_expand", "onyx_post", "onyx_hand_expand");
|
||||
shaderProgram = ShaderProgram.load("onyx_hand_smooth", "onyx_post", "onyx_hand_smooth");
|
||||
shaderProgram3 = ShaderProgram.load("onyx_hand_aurora", "onyx_post", "onyx_hand_aurora");
|
||||
shaderProgram2 = ShaderProgram.load("onyx_hand_blit", "onyx_post", "onyx_hand_blit");
|
||||
}
|
||||
|
||||
return shaderProgram4 != null
|
||||
&& shaderProgram4.isLoaded()
|
||||
&& shaderProgram != null
|
||||
&& shaderProgram.isLoaded()
|
||||
&& shaderProgram3 != null
|
||||
&& shaderProgram3.isLoaded()
|
||||
&& shaderProgram2 != null
|
||||
&& shaderProgram2.isLoaded();
|
||||
}
|
||||
|
||||
static void L(RenderTarget renderTarget, Framebuffer framebuffer, GlintEffect glintEffect, int i, int j) {
|
||||
RenderTarget renderTarget1 = renderTarget;
|
||||
if (L()) {
|
||||
int m = renderTarget1.getWidth();
|
||||
int kx = renderTarget1.getHeight();
|
||||
float fx = m / Math.max(1.0F, i);
|
||||
RENDER_TARGET5.resize(m, kx);
|
||||
RENDER_TARGET2.resize(m, kx);
|
||||
RENDER_TARGET.resize(m, kx);
|
||||
RENDER_TARGET4.resize(m, kx);
|
||||
RENDER_TARGET3.resize(m, kx);
|
||||
HandMaskShader.d();
|
||||
float g = glintEffect.padding.getFloat() * fx;
|
||||
float h = glintEffect.smoothing.getFloat() * fx;
|
||||
float l;
|
||||
ScissorStack.L((l = L(g, h)) + L(g, h, L(glintEffect, fx)), m, kx);
|
||||
RENDER_TARGET5.bindAndClear();
|
||||
RENDER_TARGET2.bindAndClear();
|
||||
RENDER_TARGET.bindAndClear();
|
||||
RENDER_TARGET4.bindAndClear();
|
||||
RENDER_TARGET3.bindAndClear();
|
||||
ScissorStack.L(l, m, kx);
|
||||
d(renderTarget1, RENDER_TARGET5, 1.0F, 0.0F, g);
|
||||
d(RENDER_TARGET5, RENDER_TARGET2, 0.0F, 1.0F, g);
|
||||
L(RENDER_TARGET2, RENDER_TARGET, 1.0F, 0.0F, h);
|
||||
L(RENDER_TARGET, RENDER_TARGET4, 0.0F, 1.0F, h);
|
||||
L(RENDER_TARGET4, RENDER_TARGET3, glintEffect, fx, i, jx);
|
||||
ScissorStack.L(l / Math.max(fx, 1.0E-4F), i, jx);
|
||||
L(RENDER_TARGET3, framebuffer, i, jx);
|
||||
ScissorStack.d();
|
||||
HandMaskShader.L(framebuffer);
|
||||
}
|
||||
}
|
||||
|
||||
private static float L(float f, float g) {
|
||||
return 2.0F * (L(fx) + d(g)) + 4.0F;
|
||||
}
|
||||
|
||||
private static float L() {
|
||||
return (float)((System.nanoTime() - I) % 3600000000000L) / 1.0E9F;
|
||||
}
|
||||
|
||||
private static float L(float f) {
|
||||
return Math.clamp((float)Math.ceil(fx), 0.0F, 24.0F);
|
||||
}
|
||||
|
||||
private MaskedBlurShader() {
|
||||
}
|
||||
|
||||
private static void L(RenderTarget renderTarget, Framebuffer framebuffer, int i, int j) {
|
||||
framebuffer.bindFramebuffer(false);
|
||||
GlStateManager.viewport(0, 0, i, jx);
|
||||
HandMaskShader.L(0, renderTarget.getTexture());
|
||||
shaderProgram2.use();
|
||||
shaderProgram2.setUniform1i("Sampler0", 0);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 771);
|
||||
HandMaskShader.L();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
private static float L(float f, float g, float h) {
|
||||
h = (float)Math.ceil(h * 2.2F + 0.9F);
|
||||
return Math.max(Math.max(L(fx), d(g)), h) + 4.0F;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package openonyx.render;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import openonyx.core.MinecraftAccess;
|
||||
import openonyx.core.OnyxClient;
|
||||
import openonyx.render.group_p.ShaderProgram;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public final class MotionBlurShader implements MinecraftAccess {
|
||||
private static ShaderProgram shaderProgram;
|
||||
private static boolean i;
|
||||
private static boolean f;
|
||||
private static final RenderTarget RENDER_TARGET = new RenderTarget(false);
|
||||
private static boolean e;
|
||||
|
||||
public static void d() {
|
||||
i = false;
|
||||
}
|
||||
|
||||
public static void L() {
|
||||
if (!f && OnyxClient.moduleManager != null) {
|
||||
float fx;
|
||||
if ((fx = OnyxClient.moduleManager.camera.d()) <= 0.0F) {
|
||||
i = false;
|
||||
} else if (PostProcessor.L()) {
|
||||
if (!e) {
|
||||
e = true;
|
||||
shaderProgram = ShaderProgram.load("onyx_motion_blur", "onyx_post", "onyx_motion_blur");
|
||||
}
|
||||
|
||||
if (shaderProgram != null && shaderProgram.isLoaded()) {
|
||||
int ix = PostProcessor.d();
|
||||
int j = PostProcessor.L();
|
||||
if (ix > 0 && j > 0) {
|
||||
try {
|
||||
if (RENDER_TARGET.resize(ix, j)) {
|
||||
i = false;
|
||||
}
|
||||
|
||||
if (i) {
|
||||
float g = fx;
|
||||
PostProcessor.L(shaderProgram, shaderProgram -> {
|
||||
HandMaskShader.L(1, RENDER_TARGET.getTexture());
|
||||
shaderProgramx.setUniform1i("Sampler1", 1);
|
||||
shaderProgramx.setUniform1f("uAmount", g);
|
||||
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
});
|
||||
HandMaskShader.L(1, 0);
|
||||
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
}
|
||||
|
||||
GlStateManager.bindTexture(RENDER_TARGET.getTexture());
|
||||
GL11.glCopyTexSubImage2D(3553, 0, 0, 0, 0, 0, ix, j);
|
||||
GlStateManager.bindTexture(0);
|
||||
i = true;
|
||||
} catch (Throwable throwable) {
|
||||
OnyxClient.LOGGER.error("Motion blur disabled", throwable);
|
||||
f = true;
|
||||
i = false;
|
||||
RENDER_TARGET.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MotionBlurShader() {
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user