Crappy Models...

Transformed broken models into crappy models!
This commit is contained in:
PeytonPlayz595 2023-07-11 11:48:26 -04:00
parent 2942b2fd7b
commit 14d9e68322
3 changed files with 67 additions and 5 deletions

View File

@ -3,6 +3,9 @@ package com.mojang.minecraft.model;
import com.mojang.minecraft.model.TexturedQuad; import com.mojang.minecraft.model.TexturedQuad;
import com.mojang.minecraft.model.Vec3D; import com.mojang.minecraft.model.Vec3D;
import com.mojang.minecraft.model.Vertex; import com.mojang.minecraft.model.Vertex;
import net.PeytonPlayz585.lwjgl.ModeBuffer;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public final class ModelPart { public final class ModelPart {
@ -128,7 +131,7 @@ public final class ModelPart {
public void generateList(float var1) { public void generateList(float var1) {
this.list = GL11.glGenLists(1); this.list = GL11.glGenLists(1);
GL11.glNewList(this.list, 4864); GL11.glNewList(this.list, 4864);
GL11.glBegin(7); GL11.glBeginQuery(7);
for(int var2 = 0; var2 < this.quads.length; ++var2) { for(int var2 = 0; var2 < this.quads.length; ++var2) {
TexturedQuad var10000 = this.quads[var2]; TexturedQuad var10000 = this.quads[var2];
@ -140,12 +143,13 @@ public final class ModelPart {
for(int var7 = 0; var7 < 4; ++var7) { for(int var7 = 0; var7 < 4; ++var7) {
Vertex var8; Vertex var8;
GL11.glTexCoord2f((var8 = var4.vertices[var7]).u, var8.v); final ModeBuffer imb = new ModeBuffer(1024);
GL11.glVertex3f(var8.vector.x * var3, var8.vector.y * var3, var8.vector.z * var3); imb.glTexCoord2f((var8 = var4.vertices[var7]).u, var8.v);
imb.glVertex3f(var8.vector.x * var3, var8.vector.y * var3, var8.vector.z * var3);
} }
} }
GL11.glEnd(); GL11.glEndQuery();
GL11.glEndList(); GL11.glEndList();
this.hasList = true; this.hasList = true;
} }

View File

@ -0,0 +1,58 @@
package net.PeytonPlayz585.lwjgl;
import org.lwjgl.BufferUtils;
import java.nio.FloatBuffer;
/**
* Utility class that emulates immediate mode vertex data submission.
* Can be used to create VBO data.
*/
public final class ModeBuffer {
private FloatBuffer buffer;
public ModeBuffer(final int startSize) {
this.buffer = BufferUtils.createFloatBuffer(startSize);
}
private void checkSize(final int count) {
while ( buffer.remaining() < count ) {
final FloatBuffer newBuffer = BufferUtils.createFloatBuffer(buffer.capacity() << 1);
buffer.flip();
newBuffer.put(buffer);
buffer = newBuffer;
}
}
public FloatBuffer getBuffer() {
buffer.flip();
return buffer;
}
public void glVertex2f(final float x, final float y) {
checkSize(2);
buffer.put(x).put(y);
}
public void glVertex3f(final float x, final float y, final float z) {
checkSize(3);
buffer.put(x).put(y).put(z);
}
public void glVertex4f(final float x, final float y, final float z, final float w) {
checkSize(4);
buffer.put(x).put(y).put(z).put(w);
}
public void glNormal3f(final float x, final float y, final float z) {
checkSize(3);
buffer.put(x).put(y).put(z);
}
public void glTexCoord2f(final float s, final float t) {
checkSize(2);
buffer.put(s).put(t);
}
}

View File

@ -1131,7 +1131,7 @@ public class GlStateManager extends LWJGL {
} }
} }
public static final void glMultiTexCoord2f(int p1, float p2, float p3) { public static final void glMultiTexCoord2f(float p2, float p3) {
tex0X = p2; tex0X = p2;
tex0Y = p3; tex0Y = p3;
} }