Fixed colors, more rendering BS

This commit is contained in:
peytonplayz585 2023-07-25 23:21:06 -07:00
parent 4f9570d239
commit 4d83e4302c
3 changed files with 24 additions and 42 deletions

View File

@ -596,42 +596,42 @@ public class Block
float var10;
if(this.canRenderSide(var1, var2, var3 - 1, var4, 0)) {
var10 = this.getBrightness(var1, var2, var3 - 1, var4);
tessellator.setColorOpaque_F(var7 * var10, var7 * var10, var7 * var10);
tessellator.setColorRGBA_F(var7, var7, var7, var7);
this.renderInside(var2, var3, var4, 0);
var6 = true;
}
if(this.canRenderSide(var1, var2, var3 + 1, var4, 1)) {
var10 = this.getBrightness(var1, var2, var3 + 1, var4);
tessellator.setColorOpaque_F(var10 * 1.0F, var10 * 1.0F, var10 * 1.0F);
tessellator.setColorRGBA_F(var10 * 1.0F, var10 * 1.0F, var10 * 1.0F, var10 * 1.0F);
this.renderInside(var2, var3, var4, 1);
var6 = true;
}
if(this.canRenderSide(var1, var2, var3, var4 - 1, 2)) {
var10 = this.getBrightness(var1, var2, var3, var4 - 1);
tessellator.setColorOpaque_F(var8 * var10, var8 * var10, var8 * var10);
tessellator.setColorRGBA_F(var8 * var10, var8 * var10, var8 * var10, var9 * 10);
this.renderInside(var2, var3, var4, 2);
var6 = true;
}
if(this.canRenderSide(var1, var2, var3, var4 + 1, 3)) {
var10 = this.getBrightness(var1, var2, var3, var4 + 1);
tessellator.setColorOpaque_F(var8 * var10, var8 * var10, var8 * var10);
tessellator.setColorRGBA_F(var8 * var10, var8 * var10, var8 * var10, var8 * var10);
this.renderInside(var2, var3, var4, 3);
var6 = true;
}
if(this.canRenderSide(var1, var2 - 1, var3, var4, 4)) {
var10 = this.getBrightness(var1, var2 - 1, var3, var4);
tessellator.setColorOpaque_F(var9 * var10, var9 * var10, var9 * var10);
tessellator.setColorRGBA_F(var9 * var10, var9 * var10, var9 * var10, var9 * var10);
this.renderInside(var2, var3, var4, 4);
var6 = true;
}
if(this.canRenderSide(var1, var2 + 1, var3, var4, 5)) {
var10 = this.getBrightness(var1, var2 + 1, var3, var4);
tessellator.setColorOpaque_F(var9 * var10, var9 * var10, var9 * var10);
tessellator.setColorRGBA_F(var9 * var10, var9 * var10, var9 * var10, var9 * var10);
this.renderInside(var2, var3, var4, 5);
var6 = true;
}

View File

@ -30,7 +30,7 @@ public class FixedFunctionShader {
FixedFunctionShader s = instances[i];
if (s == null) {
boolean CC_a_color = false;
boolean CC_a_normal = false;
// boolean CC_a_normal = false;
boolean CC_a_texture0 = false;
boolean CC_lighting = false;
boolean CC_fog = false;
@ -57,7 +57,7 @@ public class FixedFunctionShader {
if ((i & UNIT0) == UNIT0) {
CC_unit0 = true;
}
s = new FixedFunctionShader(i, CC_a_color, CC_a_normal, CC_a_texture0, CC_lighting, CC_fog, CC_alphatest, CC_unit0);
s = new FixedFunctionShader(i, CC_a_color, CC_a_texture0, CC_lighting, CC_fog, CC_alphatest, CC_unit0);
instances[i] = s;
}
return s;
@ -66,7 +66,7 @@ public class FixedFunctionShader {
private static String shaderSource = null;
private final boolean enable_color;
private final boolean enable_normal;
// private final boolean enable_normal;
private final boolean enable_texture0;
private final boolean enable_lighting;
private final boolean enable_fog;
@ -106,10 +106,10 @@ public class FixedFunctionShader {
public final BufferGL genericBuffer;
public boolean bufferIsInitialized = false;
private FixedFunctionShader(int j, boolean CC_a_color, boolean CC_a_normal, boolean CC_a_texture0,
private FixedFunctionShader(int j, boolean CC_a_color, boolean CC_a_texture0,
boolean CC_lighting, boolean CC_fog, boolean CC_alphatest, boolean CC_unit0) {
enable_color = CC_a_color;
enable_normal = CC_a_normal;
// enable_normal = CC_a_normal;
enable_texture0 = CC_a_texture0;
enable_lighting = CC_lighting;
enable_fog = CC_fog;
@ -123,8 +123,8 @@ public class FixedFunctionShader {
String source = "";
if (enable_color)
source += "\n#define CC_a_color\n";
if (enable_normal)
source += "#define CC_a_normal\n";
//if (enable_normal)
//source += "#define CC_a_normal\n";
if (enable_texture0)
source += "#define CC_a_texture0\n";
if (enable_lighting)
@ -175,12 +175,12 @@ public class FixedFunctionShader {
} else {
a_color = -1;
}
if (enable_normal) {
a_normal = i++;
_wglBindAttributeLocation(globject, a_normal, "a_normal");
} else {
a_normal = -1;
}
//if (enable_normal) {
//a_normal = i++;
//_wglBindAttributeLocation(globject, a_normal, "a_normal");
//} else {
a_normal = -1;
//}
attributeIndexesToEnable = i;
@ -246,10 +246,10 @@ public class FixedFunctionShader {
_wglEnableVertexAttribArray(a_color);
_wglVertexAttribPointer(a_color, 4, _wGL_UNSIGNED_BYTE, true, 28, 20);
}
if (enable_normal) {
_wglEnableVertexAttribArray(a_normal);
_wglVertexAttribPointer(a_normal, 4, _wGL_UNSIGNED_BYTE, true, 28, 24);
}
//if (enable_normal) {
//_wglEnableVertexAttribArray(a_normal);
//_wglVertexAttribPointer(a_normal, 4, _wGL_UNSIGNED_BYTE, true, 28, 24);
//}
}
public void useProgram() {

View File

@ -36,11 +36,6 @@ public class Tessellator {
*/
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;
@ -69,9 +64,6 @@ public class Tessellator {
*/
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(525000);
@ -159,7 +151,6 @@ public class Tessellator {
this.drawMode = drawMode;
this.isDrawing = true;
this.reset();
this.hasNormals = false;
this.hasColor = false;
this.hasTexture = false;
this.isColorDisabled = false;
@ -273,10 +264,6 @@ public class Tessellator {
intBuffer0.set(bufferIndex + 5, this.color);
}
if (this.hasNormals) {
intBuffer0.set(bufferIndex + 6, this.normal);
}
this.rawBufferIndex += 7;
}
@ -313,12 +300,7 @@ public class Tessellator {
* 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;
GL11.glNormal3f(par1, par2, par3);
}
/**