Fixed even more rendering stuff

Even more rendering BS!
This commit is contained in:
PeytonPlayz595 2023-07-19 13:16:33 -04:00
parent 0deaced874
commit be9e587a96
7 changed files with 291 additions and 166 deletions

View File

@ -100,16 +100,15 @@ public final class ModelRenderer {
var4.startDrawingQuads(); var4.startDrawingQuads();
TexturedQuad var10000 = var2.faces[var5]; TexturedQuad var10000 = var2.faces[var5];
float var8 = var3; float var8 = var3;
Tessellator var7 = var4;
TexturedQuad var6 = var10000; TexturedQuad var6 = var10000;
Vec3D var9 = var6.vertexPositions[1].vector3D.subtract(var6.vertexPositions[0].vector3D).normalize(); Vec3D var9 = var6.vertexPositions[1].vector3D.subtract(var6.vertexPositions[0].vector3D).normalize();
Vec3D var10 = var6.vertexPositions[1].vector3D.subtract(var6.vertexPositions[2].vector3D).normalize(); Vec3D var10 = var6.vertexPositions[1].vector3D.subtract(var6.vertexPositions[2].vector3D).normalize();
var9 = (new Vec3D(var9.yCoord * var10.zCoord - var9.zCoord * var10.yCoord, var9.zCoord * var10.xCoord - var9.xCoord * var10.zCoord, var9.xCoord * var10.yCoord - var9.yCoord * var10.xCoord)).normalize(); var9 = (new Vec3D(var9.yCoord * var10.zCoord - var9.zCoord * var10.yCoord, var9.zCoord * var10.xCoord - var9.xCoord * var10.zCoord, var9.xCoord * var10.yCoord - var9.yCoord * var10.xCoord)).normalize();
Tessellator.setNormal(-var9.xCoord, -var9.yCoord, -var9.zCoord); var4.setNormal(-var9.xCoord, -var9.yCoord, -var9.zCoord);
for(int var11 = 0; var11 < 4; ++var11) { for(int var11 = 0; var11 < 4; ++var11) {
PositionTextureVertex var12 = var6.vertexPositions[var11]; PositionTextureVertex var12 = var6.vertexPositions[var11];
var7.addVertexWithUV(var12.vector3D.xCoord * var8, var12.vector3D.yCoord * var8, var12.vector3D.zCoord * var8, var12.texturePositionX, var12.texturePositionY); var4.addVertexWithUV(var12.vector3D.xCoord * var8, var12.vector3D.yCoord * var8, var12.vector3D.zCoord * var8, var12.texturePositionX, var12.texturePositionY);
} }
var4.draw(); var4.draw();

View File

@ -83,21 +83,21 @@ public final class ItemRenderer {
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-(15.0F / 16.0F), -(1.0F / 16.0F), 0.0F); GL11.glTranslatef(-(15.0F / 16.0F), -(1.0F / 16.0F), 0.0F);
Tessellator.setNormal(0.0F, 0.0F, 1.0F); var11.setNormal(0.0F, 0.0F, 1.0F);
var11.startDrawingQuads(); var11.startDrawingQuads();
var11.addVertexWithUV(0.0F, 0.0F, 0.0F, var1, var9); var11.addVertexWithUV(0.0F, 0.0F, 0.0F, var1, var9);
var11.addVertexWithUV(1.0F, 0.0F, 0.0F, var5, var9); var11.addVertexWithUV(1.0F, 0.0F, 0.0F, var5, var9);
var11.addVertexWithUV(1.0F, 1.0F, 0.0F, var5, var2); var11.addVertexWithUV(1.0F, 1.0F, 0.0F, var5, var2);
var11.addVertexWithUV(0.0F, 1.0F, 0.0F, var1, var2); var11.addVertexWithUV(0.0F, 1.0F, 0.0F, var1, var2);
var11.draw(); var11.draw();
Tessellator.setNormal(0.0F, 0.0F, -1.0F); var11.setNormal(0.0F, 0.0F, -1.0F);
var11.startDrawingQuads(); var11.startDrawingQuads();
var11.addVertexWithUV(0.0F, 1.0F, -(1.0F / 16.0F), var1, var2); var11.addVertexWithUV(0.0F, 1.0F, -(1.0F / 16.0F), var1, var2);
var11.addVertexWithUV(1.0F, 1.0F, -(1.0F / 16.0F), var5, var2); var11.addVertexWithUV(1.0F, 1.0F, -(1.0F / 16.0F), var5, var2);
var11.addVertexWithUV(1.0F, 0.0F, -(1.0F / 16.0F), var5, var9); var11.addVertexWithUV(1.0F, 0.0F, -(1.0F / 16.0F), var5, var9);
var11.addVertexWithUV(0.0F, 0.0F, -(1.0F / 16.0F), var1, var9); var11.addVertexWithUV(0.0F, 0.0F, -(1.0F / 16.0F), var1, var9);
var11.draw(); var11.draw();
Tessellator.setNormal(-1.0F, 0.0F, 0.0F); var11.setNormal(-1.0F, 0.0F, 0.0F);
var11.startDrawingQuads(); var11.startDrawingQuads();
int var6; int var6;
@ -114,7 +114,7 @@ public final class ItemRenderer {
} }
var11.draw(); var11.draw();
Tessellator.setNormal(1.0F, 0.0F, 0.0F); var11.setNormal(1.0F, 0.0F, 0.0F);
var11.startDrawingQuads(); var11.startDrawingQuads();
for(var6 = 0; var6 < 16; ++var6) { for(var6 = 0; var6 < 16; ++var6) {
@ -128,7 +128,7 @@ public final class ItemRenderer {
} }
var11.draw(); var11.draw();
Tessellator.setNormal(0.0F, 1.0F, 0.0F); var11.setNormal(0.0F, 1.0F, 0.0F);
var11.startDrawingQuads(); var11.startDrawingQuads();
for(var6 = 0; var6 < 16; ++var6) { for(var6 = 0; var6 < 16; ++var6) {
@ -142,7 +142,7 @@ public final class ItemRenderer {
} }
var11.draw(); var11.draw();
Tessellator.setNormal(0.0F, -1.0F, 0.0F); var11.setNormal(0.0F, -1.0F, 0.0F);
var11.startDrawingQuads(); var11.startDrawingQuads();
for(var6 = 0; var6 < 16; ++var6) { for(var6 = 0; var6 < 16; ++var6) {

View File

@ -761,44 +761,44 @@ public final class RenderBlocks {
if(var3 == 0) { if(var3 == 0) {
GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(0.0F, -1.0F, 0.0F); var2.setNormal(0.0F, -1.0F, 0.0F);
this.renderBlockBottom(var1, 0.0F, 0.0F, 0.0F, var1.getBlockTextureFromSide(0)); this.renderBlockBottom(var1, 0.0F, 0.0F, 0.0F, var1.getBlockTextureFromSide(0));
var2.draw(); var2.draw();
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(0.0F, 1.0F, 0.0F); var2.setNormal(0.0F, 1.0F, 0.0F);
this.renderBlockTop(var1, 0.0F, 0.0F, 0.0F, var1.getBlockTextureFromSide(1)); this.renderBlockTop(var1, 0.0F, 0.0F, 0.0F, var1.getBlockTextureFromSide(1));
var2.draw(); var2.draw();
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(0.0F, 0.0F, -1.0F); var2.setNormal(0.0F, 0.0F, -1.0F);
this.renderBlockNorth(var1, 0, 0, 0, var1.getBlockTextureFromSide(2)); this.renderBlockNorth(var1, 0, 0, 0, var1.getBlockTextureFromSide(2));
var2.draw(); var2.draw();
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(0.0F, 0.0F, 1.0F); var2.setNormal(0.0F, 0.0F, 1.0F);
this.renderBlockSouth(var1, 0, 0, 0, var1.getBlockTextureFromSide(3)); this.renderBlockSouth(var1, 0, 0, 0, var1.getBlockTextureFromSide(3));
var2.draw(); var2.draw();
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(-1.0F, 0.0F, 0.0F); var2.setNormal(-1.0F, 0.0F, 0.0F);
this.renderBlockWest(var1, 0, 0, 0, var1.getBlockTextureFromSide(4)); this.renderBlockWest(var1, 0, 0, 0, var1.getBlockTextureFromSide(4));
var2.draw(); var2.draw();
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(1.0F, 0.0F, 0.0F); var2.setNormal(1.0F, 0.0F, 0.0F);
this.renderBlockEast(var1, 0, 0, 0, var1.getBlockTextureFromSide(5)); this.renderBlockEast(var1, 0, 0, 0, var1.getBlockTextureFromSide(5));
var2.draw(); var2.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(0.5F, 0.5F, 0.5F);
} else if(var3 == 1) { } else if(var3 == 1) {
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(0.0F, -1.0F, 0.0F); var2.setNormal(0.0F, -1.0F, 0.0F);
this.renderBlockPlant(var1, -1, -0.5F, -0.5F, -0.5F); this.renderBlockPlant(var1, -1, -0.5F, -0.5F, -0.5F);
var2.draw(); var2.draw();
} else if(var3 == 6) { } else if(var3 == 6) {
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(0.0F, -1.0F, 0.0F); var2.setNormal(0.0F, -1.0F, 0.0F);
this.renderBlockCrops(var1, -1, -0.5F, -0.5F, -0.5F); this.renderBlockCrops(var1, -1, -0.5F, -0.5F, -0.5F);
var2.draw(); var2.draw();
} else { } else {
if(var3 == 2) { if(var3 == 2) {
var2.startDrawingQuads(); var2.startDrawingQuads();
Tessellator.setNormal(0.0F, -1.0F, 0.0F); var2.setNormal(0.0F, -1.0F, 0.0F);
this.renderBlockTorch(var1, -0.5F, -0.5F, -0.5F, 0.0F, 0.0F); this.renderBlockTorch(var1, -0.5F, -0.5F, -0.5F, 0.0F, 0.0F);
var2.draw(); var2.draw();
} }

View File

@ -1,223 +1,349 @@
package net.minecraft.client.render; package net.minecraft.client.render;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBVertexBufferObject;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15; import org.teavm.jso.typedarrays.ArrayBuffer;
import org.teavm.jso.typedarrays.Float32Array;
import org.teavm.jso.typedarrays.Int32Array;
public final class Tessellator { public class Tessellator {
private static boolean convertQuadsToTriangles = false;
private static boolean tryVBO = false; /** The byte buffer used for GL allocation. */
private ByteBuffer byteBuffer = BufferUtils.createByteBuffer(8388608); private Int32Array intBuffer;
private int[] rawBuffer = new int[2097152]; private Float32Array floatBuffer;
/**
* The number of vertices to be drawn in the next draw call. Reset to 0 between
* draw calls.
*/
private int vertexCount = 0; private int vertexCount = 0;
/** The first coordinate to be used for the texture. */
private float textureU; private float textureU;
/** The second coordinate to be used for the texture. */
private float textureV; private float textureV;
/** The color (RGBA) value to be used for the following draw call. */
private int color; private int color;
/**
* Whether the current draw object for this tessellator has color values.
*/
private boolean hasColor = false; private boolean hasColor = false;
/**
* Whether the current draw object for this tessellator has texture coordinates.
*/
private boolean hasTexture = false; private boolean hasTexture = false;
/**
* Whether the current draw object for this tessellator has normal values.
*/
private boolean hasNormals = false;
/** The index into the raw buffer to be used for the next data. */
private int rawBufferIndex = 0; private int rawBufferIndex = 0;
/**
* The number of vertices manually added to the given draw call. This differs
* from vertexCount because it adds extra vertices when converting quads to
* triangles.
*/
private int addedVertices = 0; private int addedVertices = 0;
/** Disables all color information for the following draw call. */
private boolean isColorDisabled = false; private boolean isColorDisabled = false;
/** The draw mode currently being used by the tessellator. */
private int drawMode; private int drawMode;
public static Tessellator instance = new Tessellator();
/**
* An offset to be applied along the x-axis for all vertices in this draw call.
*/
private double xOffset;
/**
* An offset to be applied along the y-axis for all vertices in this draw call.
*/
private double yOffset;
/**
* An offset to be applied along the z-axis for all vertices in this draw call.
*/
private double zOffset;
/** The normal to be applied to the face being drawn. */
private int normal;
/** The static instance of the Tessellator. */
public static final Tessellator instance = new Tessellator(285000);
/** Whether this tessellator is currently in draw mode. */
private boolean isDrawing = false; private boolean isDrawing = false;
/** Whether we are currently using VBO or not. */
private boolean useVBO = false; private boolean useVBO = false;
private IntBuffer vertexBuffers;
private int vboIndex = 0;
private int vboCount = 10;
private Tessellator() { /** The size of the buffers used (in integers). */
this.useVBO = false; private int bufferSize;
if(this.useVBO) {
this.vertexBuffers = BufferUtils.createIntBuffer(this.vboCount); private Tessellator(int par1) {
ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers); this.bufferSize = par1;
ArrayBuffer a = ArrayBuffer.create(par1 * 4);
this.intBuffer = Int32Array.create(a);
this.floatBuffer = Float32Array.create(a);
} }
} /**
* Draws the data set up in this tessellator and resets the state to prepare for
public final void draw() { * new drawing.
if(!this.isDrawing) { */
throw new IllegalStateException("Not tesselating!"); public int draw() {
if (!this.isDrawing) {
return 0;
} else { } else {
this.isDrawing = false; this.isDrawing = false;
if(this.vertexCount > 0) {
IntBuffer var1 = this.byteBuffer.asIntBuffer(); if (this.vertexCount > 0) {
FloatBuffer var2 = this.byteBuffer.asFloatBuffer();
var1.clear(); if (this.hasTexture) {
var1.put(this.rawBuffer, 0, this.rawBufferIndex); GL11.glEnableVertexAttrib(GL11.GL_TEXTURE_COORD_ARRAY);
this.byteBuffer.position(0);
this.byteBuffer.limit(this.rawBufferIndex << 2);
if(this.useVBO) {
this.vboIndex = (this.vboIndex + 1) % this.vboCount;
ARBVertexBufferObject.glBindBufferARB(GL15.GL_ARRAY_BUFFER, this.vertexBuffers.get(this.vboIndex));
ARBVertexBufferObject.glBufferDataARB(GL15.GL_ARRAY_BUFFER, this.byteBuffer, GL15.GL_STREAM_DRAW);
} }
if(this.hasTexture) { if (this.hasColor) {
if(this.useVBO) { GL11.glEnableVertexAttrib(GL11.GL_COLOR_ARRAY);
GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 32, 12L);
} else {
var2.position(3);
GL11.glTexCoordPointer(2, 32, (FloatBuffer)var2);
} }
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); if (this.hasNormals) {
GL11.glEnableVertexAttrib(GL11.GL_NORMAL_ARRAY);
} }
if(this.hasColor) { GL11.glDrawArrays(this.drawMode, 0, this.vertexCount, Int32Array.create(intBuffer.getBuffer(), 0, this.vertexCount * 7));
if(this.useVBO) {
GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 32, 20L); if (this.hasTexture) {
} else { GL11.glDisableVertexAttrib(GL11.GL_TEXTURE_COORD_ARRAY);
this.byteBuffer.position(20);
GL11.glColorPointer(4, true, 32, this.byteBuffer);
} }
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); if (this.hasColor) {
GL11.glDisableVertexAttrib(GL11.GL_COLOR_ARRAY);
} }
if(this.useVBO) { if (this.hasNormals) {
GL11.glVertexPointer(3, GL11.GL_FLOAT, 32, 0L); GL11.glDisableVertexAttrib(GL11.GL_NORMAL_ARRAY);
} else {
var2.position(0);
GL11.glVertexPointer(3, 32, (FloatBuffer)var2);
}
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glDrawArrays(this.drawMode, GL11.GL_POINTS, this.vertexCount);
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
if(this.hasTexture) {
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}
if(this.hasColor) {
GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
} }
} }
int var1 = this.rawBufferIndex * 4;
this.reset(); this.reset();
return var1;
} }
} }
/**
* Clears the tessellator state in preparation for new drawing.
*/
private void reset() { private void reset() {
this.vertexCount = 0; this.vertexCount = 0;
this.byteBuffer.clear(); //this.byteBuffer.clear();
this.rawBufferIndex = 0; this.rawBufferIndex = 0;
this.addedVertices = 0; this.addedVertices = 0;
} }
public final void startDrawingQuads() { /**
this.startDrawing(7); * Sets draw mode in the tessellator to draw quads.
*/
public void startDrawingQuads() {
this.startDrawing(GL11.GL_QUADS);
} }
public final void startDrawing(int var1) { /**
if(this.isDrawing) { * Resets tessellator state and prepares for drawing (with the specified draw
throw new IllegalStateException("Already tesselating!"); * mode).
} else { */
public void startDrawing(int par1) {
if (this.isDrawing) {
this.draw();
}
this.isDrawing = true; this.isDrawing = true;
this.reset(); this.reset();
this.drawMode = var1; this.drawMode = par1;
this.hasNormals = false;
this.hasColor = false; this.hasColor = false;
this.hasTexture = false; this.hasTexture = false;
this.isColorDisabled = false; this.isColorDisabled = false;
} }
/**
* Sets the texture coordinates.
*/
public void setTextureUV(double par1, double par3) {
this.hasTexture = true;
this.textureU = (float) par1;
this.textureV = (float) par3;
} }
public final void setColorOpaque_F(float var1, float var2, float var3) { /**
this.setColorOpaque((int)(var1 * 255.0F), (int)(var2 * 255.0F), (int)(var3 * 255.0F)); * Sets the RGB values as specified, converting from floats between 0 and 1 to
* integers from 0-255.
*/
public void setColorOpaque_F(float par1, float par2, float par3) {
this.setColorOpaque((int) (par1 * 255.0F), (int) (par2 * 255.0F), (int) (par3 * 255.0F));
} }
public final void setColorRGBA_F(float var1, float var2, float var3, float var4) { /**
this.setColorRGBA((int)(var1 * 255.0F), (int)(var2 * 255.0F), (int)(var3 * 255.0F), (int)(var4 * 255.0F)); * Sets the RGBA values for the color, converting from floats between 0 and 1 to
* integers from 0-255.
*/
public void setColorRGBA_F(float par1, float par2, float par3, float par4) {
this.setColorRGBA((int) (par1 * 255.0F), (int) (par2 * 255.0F), (int) (par3 * 255.0F), (int) (par4 * 255.0F));
} }
private void setColorOpaque(int var1, int var2, int var3) { /**
this.setColorRGBA(var1, var2, var3, 255); * Sets the RGB values as specified, and sets alpha to opaque.
*/
public void setColorOpaque(int par1, int par2, int par3) {
this.setColorRGBA(par1, par2, par3, 255);
} }
private void setColorRGBA(int var1, int var2, int var3, int var4) { /**
if(!this.isColorDisabled) { * Sets the RGBA values for the color. Also clamps them to 0-255.
if(var1 > 255) { */
var1 = 255; public void setColorRGBA(int par1, int par2, int par3, int par4) {
if (!this.isColorDisabled) {
if (par1 > 255) {
par1 = 255;
} }
if(var2 > 255) { if (par2 > 255) {
var2 = 255; par2 = 255;
} }
if(var3 > 255) { if (par3 > 255) {
var3 = 255; par3 = 255;
} }
if(var4 > 255) { if (par4 > 255) {
var4 = 255; par4 = 255;
} }
if(var1 < 0) { if (par1 < 0) {
var1 = 0; par1 = 0;
} }
if(var2 < 0) { if (par2 < 0) {
var2 = 0; par2 = 0;
} }
if(var3 < 0) { if (par3 < 0) {
var3 = 0; par3 = 0;
} }
if(var4 < 0) { if (par4 < 0) {
var4 = 0; par4 = 0;
} }
this.hasColor = true; this.hasColor = true;
this.color = var4 << 24 | var3 << 16 | var2 << 8 | var1; this.color = par4 << 24 | par3 << 16 | par2 << 8 | par1;
} }
} }
public final void addVertexWithUV(float var1, float var2, float var3, float var4, float var5) { /**
this.hasTexture = true; * Adds a vertex specifying both x,y,z and the texture u,v for it.
this.textureU = var4; */
this.textureV = var5; public void addVertexWithUV(double par1, double par3, double par5, double par7, double par9) {
this.addVertex(var1, var2, var3); this.setTextureUV(par7, par9);
this.addVertex(par1, par3, par5);
} }
public final void addVertex(float var1, float var2, float var3) { /**
* Adds a vertex with the specified x,y,z to the current draw call. It will
* trigger a draw() if the buffer gets full.
*/
public void addVertex(double par1, double par3, double par5) {
if(this.addedVertices > 65534) return;
++this.addedVertices; ++this.addedVertices;
if(this.hasTexture) {
this.rawBuffer[this.rawBufferIndex + 3] = Float.floatToRawIntBits(this.textureU);
this.rawBuffer[this.rawBufferIndex + 4] = Float.floatToRawIntBits(this.textureV);
}
if(this.hasColor) {
this.rawBuffer[this.rawBufferIndex + 5] = this.color;
}
this.rawBuffer[this.rawBufferIndex] = Float.floatToRawIntBits(var1);
this.rawBuffer[this.rawBufferIndex + 1] = Float.floatToRawIntBits(var2);
this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits(var3);
this.rawBufferIndex += 8;
++this.vertexCount; ++this.vertexCount;
if(this.vertexCount % 4 == 0 && this.rawBufferIndex >= 2097120) {
this.draw(); int bufferIndex = this.rawBufferIndex;
Int32Array intBuffer0 = intBuffer;
Float32Array floatBuffer0 = floatBuffer;
floatBuffer0.set(bufferIndex + 0, (float) (par1 + this.xOffset));
floatBuffer0.set(bufferIndex + 1, (float) (par3 + this.yOffset));
floatBuffer0.set(bufferIndex + 2, (float) (par5 + this.zOffset));
if (this.hasTexture) {
floatBuffer0.set(bufferIndex + 3, this.textureU);
floatBuffer0.set(bufferIndex + 4, this.textureV);
} }
if (this.hasColor) {
intBuffer0.set(bufferIndex + 5, this.color);
} }
public final void setColorOpaque_I(int var1) { if (this.hasNormals) {
int var2 = var1 >> 16 & 255; intBuffer0.set(bufferIndex + 6, this.normal);
int var3 = var1 >> 8 & 255;
var1 &= 255;
this.setColorOpaque(var2, var3, var1);
} }
public final void disableColor() { this.rawBufferIndex += 7;
}
/**
* Sets the color to the given opaque value (stored as byte values packed in an
* integer).
*/
public void setColorOpaque_I(int par1) {
int var2 = par1 >> 16 & 255;
int var3 = par1 >> 8 & 255;
int var4 = par1 & 255;
this.setColorOpaque(var2, var3, var4);
}
/**
* Sets the color to the given color (packed as bytes in integer) and alpha
* values.
*/
public void setColorRGBA_I(int par1, int par2) {
int var3 = par1 >> 16 & 255;
int var4 = par1 >> 8 & 255;
int var5 = par1 & 255;
this.setColorRGBA(var3, var4, var5, par2);
}
/**
* Disables colors for the current draw call.
*/
public void disableColor() {
this.isColorDisabled = true; this.isColorDisabled = true;
} }
public static void setNormal(float var0, float var1, float var2) { /**
GL11.glNormal3f(var0, var1, var2); * Sets the normal for the current draw call.
*/
public void setNormal(float par1, float par2, float par3) {
this.hasNormals = true;
float len = (float) Math.sqrt(par1 * par1 + par2 * par2 + par3 * par3);
int var4 = (int)((par1 / len) * 125.0F) + 125;
int var5 = (int)((par2 / len) * 125.0F) + 125;
int var6 = (int)((par3 / len) * 125.0F) + 125;
this.normal = var4 & 255 | (var5 & 255) << 8 | (var6 & 255) << 16;
}
/**
* Sets the translation for all vertices in the current draw call.
*/
public void setTranslationD(double par1, double par3, double par5) {
this.xOffset = par1;
this.yOffset = par3;
this.zOffset = par5;
}
/**
* Offsets the translation for all vertices in the current draw call.
*/
public void setTranslationF(float par1, float par2, float par3) {
this.xOffset += (float) par1;
this.yOffset += (float) par2;
this.zOffset += (float) par3;
} }
} }

View File

@ -39,32 +39,32 @@ public abstract class Render {
Tessellator var1 = Tessellator.instance; Tessellator var1 = Tessellator.instance;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
var1.startDrawingQuads(); var1.startDrawingQuads();
Tessellator.setNormal(0.0F, 0.0F, -1.0F); var1.setNormal(0.0F, 0.0F, -1.0F);
var1.addVertex(var0.minX, var0.maxY, var0.minZ); var1.addVertex(var0.minX, var0.maxY, var0.minZ);
var1.addVertex(var0.maxX, var0.maxY, var0.minZ); var1.addVertex(var0.maxX, var0.maxY, var0.minZ);
var1.addVertex(var0.maxX, var0.minY, var0.minZ); var1.addVertex(var0.maxX, var0.minY, var0.minZ);
var1.addVertex(var0.minX, var0.minY, var0.minZ); var1.addVertex(var0.minX, var0.minY, var0.minZ);
Tessellator.setNormal(0.0F, 0.0F, 1.0F); var1.setNormal(0.0F, 0.0F, 1.0F);
var1.addVertex(var0.minX, var0.minY, var0.maxZ); var1.addVertex(var0.minX, var0.minY, var0.maxZ);
var1.addVertex(var0.maxX, var0.minY, var0.maxZ); var1.addVertex(var0.maxX, var0.minY, var0.maxZ);
var1.addVertex(var0.maxX, var0.maxY, var0.maxZ); var1.addVertex(var0.maxX, var0.maxY, var0.maxZ);
var1.addVertex(var0.minX, var0.maxY, var0.maxZ); var1.addVertex(var0.minX, var0.maxY, var0.maxZ);
Tessellator.setNormal(0.0F, -1.0F, 0.0F); var1.setNormal(0.0F, -1.0F, 0.0F);
var1.addVertex(var0.minX, var0.minY, var0.minZ); var1.addVertex(var0.minX, var0.minY, var0.minZ);
var1.addVertex(var0.maxX, var0.minY, var0.minZ); var1.addVertex(var0.maxX, var0.minY, var0.minZ);
var1.addVertex(var0.maxX, var0.minY, var0.maxZ); var1.addVertex(var0.maxX, var0.minY, var0.maxZ);
var1.addVertex(var0.minX, var0.minY, var0.maxZ); var1.addVertex(var0.minX, var0.minY, var0.maxZ);
Tessellator.setNormal(0.0F, 1.0F, 0.0F); var1.setNormal(0.0F, 1.0F, 0.0F);
var1.addVertex(var0.minX, var0.maxY, var0.maxZ); var1.addVertex(var0.minX, var0.maxY, var0.maxZ);
var1.addVertex(var0.maxX, var0.maxY, var0.maxZ); var1.addVertex(var0.maxX, var0.maxY, var0.maxZ);
var1.addVertex(var0.maxX, var0.maxY, var0.minZ); var1.addVertex(var0.maxX, var0.maxY, var0.minZ);
var1.addVertex(var0.minX, var0.maxY, var0.minZ); var1.addVertex(var0.minX, var0.maxY, var0.minZ);
Tessellator.setNormal(-1.0F, 0.0F, 0.0F); var1.setNormal(-1.0F, 0.0F, 0.0F);
var1.addVertex(var0.minX, var0.minY, var0.maxZ); var1.addVertex(var0.minX, var0.minY, var0.maxZ);
var1.addVertex(var0.minX, var0.maxY, var0.maxZ); var1.addVertex(var0.minX, var0.maxY, var0.maxZ);
var1.addVertex(var0.minX, var0.maxY, var0.minZ); var1.addVertex(var0.minX, var0.maxY, var0.minZ);
var1.addVertex(var0.minX, var0.minY, var0.minZ); var1.addVertex(var0.minX, var0.minY, var0.minZ);
Tessellator.setNormal(1.0F, 0.0F, 0.0F); var1.setNormal(1.0F, 0.0F, 0.0F);
var1.addVertex(var0.maxX, var0.minY, var0.minZ); var1.addVertex(var0.maxX, var0.minY, var0.minZ);
var1.addVertex(var0.maxX, var0.maxY, var0.minZ); var1.addVertex(var0.maxX, var0.maxY, var0.minZ);
var1.addVertex(var0.maxX, var0.maxY, var0.maxZ); var1.addVertex(var0.maxX, var0.maxY, var0.maxZ);

View File

@ -184,7 +184,7 @@ public final class RenderItem extends Render {
GL11.glRotatef(180.0F - var12.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(180.0F - var12.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
var15.startDrawingQuads(); var15.startDrawingQuads();
Tessellator.setNormal(0.0F, 1.0F, 0.0F); var15.setNormal(0.0F, 1.0F, 0.0F);
var15.addVertexWithUV(-0.5F, -0.25F, 0.0F, var4, var2); var15.addVertexWithUV(-0.5F, -0.25F, 0.0F, var4, var2);
var15.addVertexWithUV(0.5F, -0.25F, 0.0F, var5, var2); var15.addVertexWithUV(0.5F, -0.25F, 0.0F, var5, var2);
var15.addVertexWithUV(0.5F, 12.0F / 16.0F, 0.0F, var5, var6); var15.addVertexWithUV(0.5F, 12.0F / 16.0F, 0.0F, var5, var6);

View File

@ -65,32 +65,32 @@ public final class RenderPainting extends Render {
var18 = (float)(var27 + var25 - (var10 + 1 << 4)) / 256.0F; var18 = (float)(var27 + var25 - (var10 + 1 << 4)) / 256.0F;
Tessellator var29 = Tessellator.instance; Tessellator var29 = Tessellator.instance;
var29.startDrawingQuads(); var29.startDrawingQuads();
Tessellator.setNormal(0.0F, 0.0F, -1.0F); var29.setNormal(0.0F, 0.0F, -1.0F);
var29.addVertexWithUV(var11, var14, -0.5F, var16, var17); var29.addVertexWithUV(var11, var14, -0.5F, var16, var17);
var29.addVertexWithUV(var12, var14, -0.5F, var15, var17); var29.addVertexWithUV(var12, var14, -0.5F, var15, var17);
var29.addVertexWithUV(var12, var13, -0.5F, var15, var18); var29.addVertexWithUV(var12, var13, -0.5F, var15, var18);
var29.addVertexWithUV(var11, var13, -0.5F, var16, var18); var29.addVertexWithUV(var11, var13, -0.5F, var16, var18);
Tessellator.setNormal(0.0F, 0.0F, 1.0F); var29.setNormal(0.0F, 0.0F, 1.0F);
var29.addVertexWithUV(var11, var13, 0.5F, 12.0F / 16.0F, 0.0F); var29.addVertexWithUV(var11, var13, 0.5F, 12.0F / 16.0F, 0.0F);
var29.addVertexWithUV(var12, var13, 0.5F, 13.0F / 16.0F, 0.0F); var29.addVertexWithUV(var12, var13, 0.5F, 13.0F / 16.0F, 0.0F);
var29.addVertexWithUV(var12, var14, 0.5F, 13.0F / 16.0F, 1.0F / 16.0F); var29.addVertexWithUV(var12, var14, 0.5F, 13.0F / 16.0F, 1.0F / 16.0F);
var29.addVertexWithUV(var11, var14, 0.5F, 12.0F / 16.0F, 1.0F / 16.0F); var29.addVertexWithUV(var11, var14, 0.5F, 12.0F / 16.0F, 1.0F / 16.0F);
Tessellator.setNormal(0.0F, -1.0F, 0.0F); var29.setNormal(0.0F, -1.0F, 0.0F);
var29.addVertexWithUV(var11, var13, -0.5F, 12.0F / 16.0F, 0.001953125F); var29.addVertexWithUV(var11, var13, -0.5F, 12.0F / 16.0F, 0.001953125F);
var29.addVertexWithUV(var12, var13, -0.5F, 13.0F / 16.0F, 0.001953125F); var29.addVertexWithUV(var12, var13, -0.5F, 13.0F / 16.0F, 0.001953125F);
var29.addVertexWithUV(var12, var13, 0.5F, 13.0F / 16.0F, 0.001953125F); var29.addVertexWithUV(var12, var13, 0.5F, 13.0F / 16.0F, 0.001953125F);
var29.addVertexWithUV(var11, var13, 0.5F, 12.0F / 16.0F, 0.001953125F); var29.addVertexWithUV(var11, var13, 0.5F, 12.0F / 16.0F, 0.001953125F);
Tessellator.setNormal(0.0F, 1.0F, 0.0F); var29.setNormal(0.0F, 1.0F, 0.0F);
var29.addVertexWithUV(var11, var14, 0.5F, 12.0F / 16.0F, 0.001953125F); var29.addVertexWithUV(var11, var14, 0.5F, 12.0F / 16.0F, 0.001953125F);
var29.addVertexWithUV(var12, var14, 0.5F, 13.0F / 16.0F, 0.001953125F); var29.addVertexWithUV(var12, var14, 0.5F, 13.0F / 16.0F, 0.001953125F);
var29.addVertexWithUV(var12, var14, -0.5F, 13.0F / 16.0F, 0.001953125F); var29.addVertexWithUV(var12, var14, -0.5F, 13.0F / 16.0F, 0.001953125F);
var29.addVertexWithUV(var11, var14, -0.5F, 12.0F / 16.0F, 0.001953125F); var29.addVertexWithUV(var11, var14, -0.5F, 12.0F / 16.0F, 0.001953125F);
Tessellator.setNormal(-1.0F, 0.0F, 0.0F); var29.setNormal(-1.0F, 0.0F, 0.0F);
var29.addVertexWithUV(var11, var13, 0.5F, 385.0F / 512.0F, 0.0F); var29.addVertexWithUV(var11, var13, 0.5F, 385.0F / 512.0F, 0.0F);
var29.addVertexWithUV(var11, var14, 0.5F, 385.0F / 512.0F, 1.0F / 16.0F); var29.addVertexWithUV(var11, var14, 0.5F, 385.0F / 512.0F, 1.0F / 16.0F);
var29.addVertexWithUV(var11, var14, -0.5F, 385.0F / 512.0F, 1.0F / 16.0F); var29.addVertexWithUV(var11, var14, -0.5F, 385.0F / 512.0F, 1.0F / 16.0F);
var29.addVertexWithUV(var11, var13, -0.5F, 385.0F / 512.0F, 0.0F); var29.addVertexWithUV(var11, var13, -0.5F, 385.0F / 512.0F, 0.0F);
Tessellator.setNormal(1.0F, 0.0F, 0.0F); var29.setNormal(1.0F, 0.0F, 0.0F);
var29.addVertexWithUV(var12, var13, -0.5F, 385.0F / 512.0F, 0.0F); var29.addVertexWithUV(var12, var13, -0.5F, 385.0F / 512.0F, 0.0F);
var29.addVertexWithUV(var12, var14, -0.5F, 385.0F / 512.0F, 1.0F / 16.0F); var29.addVertexWithUV(var12, var14, -0.5F, 385.0F / 512.0F, 1.0F / 16.0F);
var29.addVertexWithUV(var12, var14, 0.5F, 385.0F / 512.0F, 1.0F / 16.0F); var29.addVertexWithUV(var12, var14, 0.5F, 385.0F / 512.0F, 1.0F / 16.0F);