Fixed colors, more rendering BS
This commit is contained in:
parent
4f9570d239
commit
4d83e4302c
|
@ -596,42 +596,42 @@ public class Block
|
||||||
float var10;
|
float var10;
|
||||||
if(this.canRenderSide(var1, var2, var3 - 1, var4, 0)) {
|
if(this.canRenderSide(var1, var2, var3 - 1, var4, 0)) {
|
||||||
var10 = this.getBrightness(var1, var2, var3 - 1, var4);
|
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);
|
this.renderInside(var2, var3, var4, 0);
|
||||||
var6 = true;
|
var6 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.canRenderSide(var1, var2, var3 + 1, var4, 1)) {
|
if(this.canRenderSide(var1, var2, var3 + 1, var4, 1)) {
|
||||||
var10 = this.getBrightness(var1, var2, var3 + 1, var4);
|
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);
|
this.renderInside(var2, var3, var4, 1);
|
||||||
var6 = true;
|
var6 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.canRenderSide(var1, var2, var3, var4 - 1, 2)) {
|
if(this.canRenderSide(var1, var2, var3, var4 - 1, 2)) {
|
||||||
var10 = this.getBrightness(var1, var2, var3, var4 - 1);
|
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);
|
this.renderInside(var2, var3, var4, 2);
|
||||||
var6 = true;
|
var6 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.canRenderSide(var1, var2, var3, var4 + 1, 3)) {
|
if(this.canRenderSide(var1, var2, var3, var4 + 1, 3)) {
|
||||||
var10 = this.getBrightness(var1, var2, var3, var4 + 1);
|
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);
|
this.renderInside(var2, var3, var4, 3);
|
||||||
var6 = true;
|
var6 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.canRenderSide(var1, var2 - 1, var3, var4, 4)) {
|
if(this.canRenderSide(var1, var2 - 1, var3, var4, 4)) {
|
||||||
var10 = this.getBrightness(var1, var2 - 1, var3, var4);
|
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);
|
this.renderInside(var2, var3, var4, 4);
|
||||||
var6 = true;
|
var6 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.canRenderSide(var1, var2 + 1, var3, var4, 5)) {
|
if(this.canRenderSide(var1, var2 + 1, var3, var4, 5)) {
|
||||||
var10 = this.getBrightness(var1, var2 + 1, var3, var4);
|
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);
|
this.renderInside(var2, var3, var4, 5);
|
||||||
var6 = true;
|
var6 = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class FixedFunctionShader {
|
||||||
FixedFunctionShader s = instances[i];
|
FixedFunctionShader s = instances[i];
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
boolean CC_a_color = false;
|
boolean CC_a_color = false;
|
||||||
boolean CC_a_normal = false;
|
// boolean CC_a_normal = false;
|
||||||
boolean CC_a_texture0 = false;
|
boolean CC_a_texture0 = false;
|
||||||
boolean CC_lighting = false;
|
boolean CC_lighting = false;
|
||||||
boolean CC_fog = false;
|
boolean CC_fog = false;
|
||||||
|
@ -57,7 +57,7 @@ public class FixedFunctionShader {
|
||||||
if ((i & UNIT0) == UNIT0) {
|
if ((i & UNIT0) == UNIT0) {
|
||||||
CC_unit0 = true;
|
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;
|
instances[i] = s;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
@ -66,7 +66,7 @@ public class FixedFunctionShader {
|
||||||
private static String shaderSource = null;
|
private static String shaderSource = null;
|
||||||
|
|
||||||
private final boolean enable_color;
|
private final boolean enable_color;
|
||||||
private final boolean enable_normal;
|
// private final boolean enable_normal;
|
||||||
private final boolean enable_texture0;
|
private final boolean enable_texture0;
|
||||||
private final boolean enable_lighting;
|
private final boolean enable_lighting;
|
||||||
private final boolean enable_fog;
|
private final boolean enable_fog;
|
||||||
|
@ -106,10 +106,10 @@ public class FixedFunctionShader {
|
||||||
public final BufferGL genericBuffer;
|
public final BufferGL genericBuffer;
|
||||||
public boolean bufferIsInitialized = false;
|
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) {
|
boolean CC_lighting, boolean CC_fog, boolean CC_alphatest, boolean CC_unit0) {
|
||||||
enable_color = CC_a_color;
|
enable_color = CC_a_color;
|
||||||
enable_normal = CC_a_normal;
|
// enable_normal = CC_a_normal;
|
||||||
enable_texture0 = CC_a_texture0;
|
enable_texture0 = CC_a_texture0;
|
||||||
enable_lighting = CC_lighting;
|
enable_lighting = CC_lighting;
|
||||||
enable_fog = CC_fog;
|
enable_fog = CC_fog;
|
||||||
|
@ -123,8 +123,8 @@ public class FixedFunctionShader {
|
||||||
String source = "";
|
String source = "";
|
||||||
if (enable_color)
|
if (enable_color)
|
||||||
source += "\n#define CC_a_color\n";
|
source += "\n#define CC_a_color\n";
|
||||||
if (enable_normal)
|
//if (enable_normal)
|
||||||
source += "#define CC_a_normal\n";
|
//source += "#define CC_a_normal\n";
|
||||||
if (enable_texture0)
|
if (enable_texture0)
|
||||||
source += "#define CC_a_texture0\n";
|
source += "#define CC_a_texture0\n";
|
||||||
if (enable_lighting)
|
if (enable_lighting)
|
||||||
|
@ -175,12 +175,12 @@ public class FixedFunctionShader {
|
||||||
} else {
|
} else {
|
||||||
a_color = -1;
|
a_color = -1;
|
||||||
}
|
}
|
||||||
if (enable_normal) {
|
//if (enable_normal) {
|
||||||
a_normal = i++;
|
//a_normal = i++;
|
||||||
_wglBindAttributeLocation(globject, a_normal, "a_normal");
|
//_wglBindAttributeLocation(globject, a_normal, "a_normal");
|
||||||
} else {
|
//} else {
|
||||||
a_normal = -1;
|
a_normal = -1;
|
||||||
}
|
//}
|
||||||
|
|
||||||
attributeIndexesToEnable = i;
|
attributeIndexesToEnable = i;
|
||||||
|
|
||||||
|
@ -246,10 +246,10 @@ public class FixedFunctionShader {
|
||||||
_wglEnableVertexAttribArray(a_color);
|
_wglEnableVertexAttribArray(a_color);
|
||||||
_wglVertexAttribPointer(a_color, 4, _wGL_UNSIGNED_BYTE, true, 28, 20);
|
_wglVertexAttribPointer(a_color, 4, _wGL_UNSIGNED_BYTE, true, 28, 20);
|
||||||
}
|
}
|
||||||
if (enable_normal) {
|
//if (enable_normal) {
|
||||||
_wglEnableVertexAttribArray(a_normal);
|
//_wglEnableVertexAttribArray(a_normal);
|
||||||
_wglVertexAttribPointer(a_normal, 4, _wGL_UNSIGNED_BYTE, true, 28, 24);
|
//_wglVertexAttribPointer(a_normal, 4, _wGL_UNSIGNED_BYTE, true, 28, 24);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void useProgram() {
|
public void useProgram() {
|
||||||
|
|
|
@ -36,11 +36,6 @@ public class Tessellator {
|
||||||
*/
|
*/
|
||||||
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. */
|
/** The index into the raw buffer to be used for the next data. */
|
||||||
private int rawBufferIndex = 0;
|
private int rawBufferIndex = 0;
|
||||||
|
|
||||||
|
@ -69,9 +64,6 @@ public class Tessellator {
|
||||||
*/
|
*/
|
||||||
private double zOffset;
|
private double zOffset;
|
||||||
|
|
||||||
/** The normal to be applied to the face being drawn. */
|
|
||||||
private int normal;
|
|
||||||
|
|
||||||
/** The static instance of the Tessellator. */
|
/** The static instance of the Tessellator. */
|
||||||
public static final Tessellator instance = new Tessellator(525000);
|
public static final Tessellator instance = new Tessellator(525000);
|
||||||
|
|
||||||
|
@ -159,7 +151,6 @@ public class Tessellator {
|
||||||
this.drawMode = drawMode;
|
this.drawMode = drawMode;
|
||||||
this.isDrawing = true;
|
this.isDrawing = true;
|
||||||
this.reset();
|
this.reset();
|
||||||
this.hasNormals = false;
|
|
||||||
this.hasColor = false;
|
this.hasColor = false;
|
||||||
this.hasTexture = false;
|
this.hasTexture = false;
|
||||||
this.isColorDisabled = false;
|
this.isColorDisabled = false;
|
||||||
|
@ -273,10 +264,6 @@ public class Tessellator {
|
||||||
intBuffer0.set(bufferIndex + 5, this.color);
|
intBuffer0.set(bufferIndex + 5, this.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasNormals) {
|
|
||||||
intBuffer0.set(bufferIndex + 6, this.normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rawBufferIndex += 7;
|
this.rawBufferIndex += 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,12 +300,7 @@ public class Tessellator {
|
||||||
* Sets the normal for the current draw call.
|
* Sets the normal for the current draw call.
|
||||||
*/
|
*/
|
||||||
public void setNormal(float par1, float par2, float par3) {
|
public void setNormal(float par1, float par2, float par3) {
|
||||||
this.hasNormals = true;
|
GL11.glNormal3f(par1, par2, par3);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user