Upload files to "src/openonyx/render"

This commit is contained in:
winterflyt committed 2026-11-30 06:14:01 +02:00
1 parent 02992196fc
commit 536bcb76a3
2 files changed
+161

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
package openonyx.render;
import net.minecraft.client.renderer.GlStateManager;
public final class TransformStack {
static final TransformStack INSTANCE = new TransformStack();
public TransformStack L(float f) {
GlStateManager.rotate((float)Math.toDegrees(f), 0.0F, 0.0F, 1.0F);
return this;
}
public TransformStack d() {
GlStateManager.popMatrix();
return this;
}
private TransformStack() {
}
public TransformStack d(float f, float g) {
GlStateManager.translate(f, g, 0.0F);
return this;
}
public TransformStack L() {
GlStateManager.pushMatrix();
return this;
}
public TransformStack L(float f, float g) {
GlStateManager.scale(f, g, 1.0F);
return this;
}
}
+126
View File
@@ -0,0 +1,126 @@
package openonyx.render;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.util.Vec3;
import openonyx.core.MinecraftAccess;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;
public final class WorldToScreen implements MinecraftAccess {
private static final FloatBuffer FLOAT_BUFFER = BufferUtils.createFloatBuffer(16);
private static Vec3 vec3 = new Vec3(0.0, 0.0, 0.0);
private static Vec3 vec32 = new Vec3(0.0, 0.0, 1.0);
private static final IntBuffer INT_BUFFER = BufferUtils.createIntBuffer(16);
private static boolean d;
private static Vec3 vec33 = new Vec3(1.0, 0.0, 0.0);
private static final FloatBuffer FLOAT_BUFFER2 = BufferUtils.createFloatBuffer(16);
private static final FloatBuffer FLOAT_BUFFER3 = BufferUtils.createFloatBuffer(3);
private static Vec3 vec34 = new Vec3(0.0, 0.0, 0.0);
static {
INT_BUFFER.put(0, 0);
INT_BUFFER.put(1, 0);
INT_BUFFER.put(2, 1);
INT_BUFFER.put(3, 1);
}
public static boolean L() {
return d;
}
public static void L(float f) {
float g = f;
Entity entity;
if ((entity = mc.getRenderViewEntity()) == null) {
d = false;
} else {
FLOAT_BUFFER2.clear();
FLOAT_BUFFER.clear();
GL11.glGetFloat(2982, FLOAT_BUFFER2);
GL11.glGetFloat(2983, FLOAT_BUFFER);
vec34 = new Vec3(
entity.prevPosX + (entity.posX - entity.prevPosX) * g,
entity.prevPosY + (entity.posY - entity.prevPosY) * g,
entity.prevPosZ + (entity.posZ - entity.prevPosZ) * g
);
vec32 = L(0.0F, 0.0F, -1.0F);
vec33 = L(-1.0F, 0.0F, 0.0F);
vec3 = vec34.add(L(-FLOAT_BUFFER2.get(12), -FLOAT_BUFFER2.get(13), -FLOAT_BUFFER2.get(14)));
d = true;
}
}
public static Vec3 getVec3() {
return vec3;
}
public static Vec3 getVec32() {
return vec32;
}
public static Vec3 getVec33() {
return vec33;
}
public static float d() {
return Math.abs(FLOAT_BUFFER.get(0));
}
private static Vec3 L(float f, float g, float h) {
return new Vec3(
FLOAT_BUFFER2.get(0) * f + FLOAT_BUFFER2.get(1) * g + FLOAT_BUFFER2.get(2) * h,
FLOAT_BUFFER2.get(4) * f + FLOAT_BUFFER2.get(5) * g + FLOAT_BUFFER2.get(6) * h,
FLOAT_BUFFER2.get(8) * f + FLOAT_BUFFER2.get(9) * g + FLOAT_BUFFER2.get(10) * h
);
}
public static float L() {
return Math.abs(FLOAT_BUFFER.get(5));
}
public static void L() {
d = false;
}
private WorldToScreen() {
}
public static float[] L(Vec3 vec3, float f, float g) {
if (!d) {
return null;
}
FLOAT_BUFFER3.clear();
if (!GLU.gluProject(
(float)(vec3x.xCoord - vec34.xCoord),
(float)(vec3x.yCoord - vec34.yCoord),
(float)(vec3x.zCoord - vec34.zCoord),
FLOAT_BUFFER2,
FLOAT_BUFFER,
INT_BUFFER,
FLOAT_BUFFER3
)) {
return null;
}
float h;
if (Float.isFinite(h = FLOAT_BUFFER3.get(2)) && !(h < 0.0F) && !(h > 1.0F)) {
f = FLOAT_BUFFER3.get(0) * f;
g = (1.0F - FLOAT_BUFFER3.get(1)) * g;
if (Float.isFinite(f) && Float.isFinite(g)) {
float[] i = new float[2];
boolean bl = true;
i[0] = f;
i[1] = g;
return i;
} else {
return null;
}
} else {
return null;
}
}
}