1
0
Fork 0

Compare commits

...

2 commits

Author SHA1 Message Date
Sen
225377bb8c
experimental new rendering 3 2025-08-30 22:33:04 +02:00
Sen
7ae19e187e
experimental new rendering: 2 pipelines 2025-08-30 22:20:27 +02:00
5 changed files with 240 additions and 132 deletions

View file

@ -737,6 +737,8 @@ public class Client implements IThreadListener {
public boolean specularColors = true; public boolean specularColors = true;
@Variable(name = "gl_flat_shading", category = CVarCategory.RENDER, display = "Flaches Shading") @Variable(name = "gl_flat_shading", category = CVarCategory.RENDER, display = "Flaches Shading")
public boolean flatShading = false; public boolean flatShading = false;
@Variable(name = "gl_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
public boolean useShader = false;
public static final Client CLIENT = new Client(); public static final Client CLIENT = new Client();

View file

@ -26,11 +26,12 @@ public class GuiGraphics extends GuiOptions {
this.addSelector("gl_dynlight_viewdist", 0, 200, 240, 0); this.addSelector("gl_dynlight_viewdist", 0, 200, 240, 0);
this.addSelector("gl_dynlight_maxdist", 242, 200, 240, 0); this.addSelector("gl_dynlight_maxdist", 242, 200, 240, 0);
this.addSelector("gl_light_blend", 0, 220, 240, 0);
this.addSelector("gl_specular", 242, 220, 240, 0);
this.addSelector("gl_flat_shading", 0, 240, 240, 0); this.addSelector("gl_use_shader", 0, 220, 240, 0);
this.addSelector("gl_light_blend", 242, 220, 240, 0);
this.addSelector("gl_specular", 0, 240, 240, 0);
this.addSelector("gl_flat_shading", 242, 240, 240, 0);
this.addSelector("gl_tex_filter", 0, 260, 240, 0); this.addSelector("gl_tex_filter", 0, 260, 240, 0);
this.addSelector("gl_tex_mipmaps", 242, 260, 240, 0); this.addSelector("gl_tex_mipmaps", 242, 260, 240, 0);

View file

@ -18,14 +18,16 @@ public class DefaultVertexFormats
public static final VertexFormatElement TEX_2F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2); public static final VertexFormatElement TEX_2F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2);
public static final VertexFormatElement TEX_2S = new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2); public static final VertexFormatElement TEX_2S = new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2);
public static final VertexFormatElement NORMAL_3B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3); public static final VertexFormatElement NORMAL_3B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3);
public static final VertexFormatElement NORMAL_4B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 4);
public static final VertexFormatElement PADDING_1B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1); public static final VertexFormatElement PADDING_1B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1);
static static
{ {
BLOCK.addElement(POSITION_3F); BLOCK.addElement(POSITION_3F);
BLOCK.addElement(COLOR_4UB); BLOCK.addElement(NORMAL_4B);
BLOCK.addElement(TEX_2F); BLOCK.addElement(TEX_2F);
BLOCK.addElement(TEX_2S); BLOCK.addElement(COLOR_4UB);
BLOCK.addElement(TEX_2S);
ITEM.addElement(POSITION_3F); ITEM.addElement(POSITION_3F);
ITEM.addElement(COLOR_4UB); ITEM.addElement(COLOR_4UB);
ITEM.addElement(TEX_2F); ITEM.addElement(TEX_2F);

View file

@ -406,6 +406,19 @@ public class RenderBuffer
return this; return this;
} }
public RenderBuffer normal(float x, float y, float z, float shine)
{
int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex);
this.byteBuffer.put(i, (byte)((int)x * 127 & 255));
this.byteBuffer.put(i + 1, (byte)((int)y * 127 & 255));
this.byteBuffer.put(i + 2, (byte)((int)z * 127 & 255));
this.byteBuffer.put(i + 3, (byte)((int)(shine / 32.0f) * 127 & 255));
this.nextVertexFormatIndex();
return this;
}
public void setTranslation(double x, double y, double z) public void setTranslation(double x, double y, double z)
{ {
this.xOffset = x; this.xOffset = x;

View file

@ -107,7 +107,8 @@ public class Renderer {
private static final float FOG_DISTANCE = 0.4f; private static final float FOG_DISTANCE = 0.4f;
private static final float SQRT_2 = ExtMath.sqrtf(2.0F); private static final float SQRT_2 = ExtMath.sqrtf(2.0F);
private static final float[] SUN_COLOR = new float[4]; private static final float[] SUN_COLOR = new float[4];
private static final float[] BRIGHTNESS = new float[] {0.0f, 0.02f, 0.04f, 0.06f, 0.08f, 0.11f, 0.14f, 0.18f, 0.22f, 0.27f, 0.33f, 0.41f, 0.5f, 0.62f, 0.78f, 1.0f}; private static final float[] BRIGHTNESS = {0.0f, 0.02f, 0.04f, 0.06f, 0.08f, 0.11f, 0.14f, 0.18f, 0.22f, 0.27f, 0.33f, 0.41f, 0.5f, 0.62f, 0.78f, 1.0f};
private static final Facing[] LIQUID_FACINGS = {Facing.NORTH, Facing.SOUTH, Facing.WEST, Facing.EAST};
private final Client gm; private final Client gm;
private final Random rng = new Random(); private final Random rng = new Random();
@ -2547,73 +2548,145 @@ public class Renderer {
this.renderChunks.add(renderchunk); this.renderChunks.add(renderchunk);
} }
} }
GlState.setActiveTexture(GL46.GL_TEXTURE1);
GL46.glMatrixMode(GL46.GL_TEXTURE);
GL46.glLoadIdentity();
GL46.glMatrixMode(GL46.GL_MODELVIEW);
this.gm.getTextureManager().bindTexture(TEX_LIGHTMAP);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, GL46.GL_LINEAR);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, GL46.GL_LINEAR);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_S, GL46.GL_CLAMP);
GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_T, GL46.GL_CLAMP);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GlState.enableTexture2D();
GlState.setActiveTexture(GL46.GL_TEXTURE0);
if (this.initialized) if(this.gm.useShader) {
{ GlState.setActiveTexture(GL46.GL_TEXTURE1);
ShaderContext context = Shader.WORLD.use(); GL46.glMatrixMode(GL46.GL_TEXTURE);
boolean moon = false; GL46.glLoadIdentity();
for(int color : this.theWorld.dimension.getMoonColors()) { GL46.glMatrixMode(GL46.GL_MODELVIEW);
if((color & 0xff000000) == 0) { this.gm.getTextureManager().bindTexture(TEX_LIGHTMAP);
moon = true; GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, GL46.GL_LINEAR);
break; GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, GL46.GL_LINEAR);
} GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_S, GL46.GL_CLAMP);
} GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_T, GL46.GL_CLAMP);
context.bool("sky_light", this.theWorld.dimension.hasSkyLight() && !this.gm.setGamma && !this.gm.xrayActive); GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
context.bool("moon_light", moon); GlState.enableTexture2D();
for (RenderChunk renderchunk : this.renderChunks) GlState.setActiveTexture(GL46.GL_TEXTURE0);
if (this.initialized)
{
ShaderContext context = Shader.WORLD.use();
boolean moon = false;
for(int color : this.theWorld.dimension.getMoonColors()) {
if((color & 0xff000000) == 0) {
moon = true;
break;
}
}
context.bool("sky_light", this.theWorld.dimension.hasSkyLight() && !this.gm.setGamma && !this.gm.xrayActive);
context.bool("moon_light", moon);
for (RenderChunk renderchunk : this.renderChunks)
{
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
BlockPos blockpos = renderchunk.getPosition();
context.vec("offset", (float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
// Vec3 cam = MatrixState.project(Client.CLIENT.getRenderViewEntity(), Client.CLIENT.getTickFraction());
context.vec("cam_pos", (float)this.viewEntityX, (float)this.viewEntityY + this.gm.player.getEyeHeight(), (float)this.viewEntityZ);
context.matrix("model", renderchunk.getModelviewMatrix());
context.integer("chunk_x", blockpos.getX());
context.integer("chunk_y", blockpos.getY());
context.integer("chunk_z", blockpos.getZ());
vertexbuffer.bindBuffer();
GL46.glVertexAttribPointer(0, 3, GL46.GL_FLOAT, false, 28, 0L);
GL46.glEnableVertexAttribArray(0);
GL46.glVertexAttribPointer(1, 4, GL46.GL_BYTE, true, 28, 12L);
GL46.glEnableVertexAttribArray(1);
GL46.glVertexAttribPointer(2, 2, GL46.GL_FLOAT, false, 28, 16L);
GL46.glEnableVertexAttribArray(2);
GL46.glVertexAttribPointer(3, 4, GL46.GL_UNSIGNED_BYTE, true, 28, 24L);
GL46.glEnableVertexAttribArray(3);
vertexbuffer.drawArrays(GL46.GL_QUADS);
GL46.glDisableVertexAttribArray(0);
GL46.glDisableVertexAttribArray(1);
GL46.glDisableVertexAttribArray(2);
GL46.glDisableVertexAttribArray(3);
}
context.finish();
GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, 0);
GlState.resetColor();
this.renderChunks.clear();
}
}
else {
this.gm.renderer.enableLightmap();
GL46.glEnableClientState(GL46.GL_VERTEX_ARRAY);
GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
GL46.glEnableClientState(GL46.GL_TEXTURE_COORD_ARRAY);
GL46.glClientActiveTexture(GL46.GL_TEXTURE1);
GL46.glEnableClientState(GL46.GL_TEXTURE_COORD_ARRAY);
GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
GL46.glEnableClientState(GL46.GL_COLOR_ARRAY);
if (this.initialized)
{ {
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer(); for (RenderChunk renderchunk : this.renderChunks)
{
BlockPos blockpos = renderchunk.getPosition(); VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
context.vec("offset", (float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ)); GL46.glPushMatrix();
// Vec3 cam = MatrixState.project(Client.CLIENT.getRenderViewEntity(), Client.CLIENT.getTickFraction()); this.preRenderChunk(renderchunk);
context.vec("cam_pos", (float)this.viewEntityX, (float)this.viewEntityY + this.gm.player.getEyeHeight(), (float)this.viewEntityZ); GL46.glMultMatrixf(renderchunk.getModelviewMatrix());
context.matrix("model", renderchunk.getModelviewMatrix()); vertexbuffer.bindBuffer();
context.integer("chunk_x", blockpos.getX()); this.setupArrayPointers();
context.integer("chunk_y", blockpos.getY()); vertexbuffer.drawArrays(GL46.GL_QUADS);
context.integer("chunk_z", blockpos.getZ()); GL46.glPopMatrix();
}
vertexbuffer.bindBuffer();
GL46.glVertexAttribPointer(0, 3, GL46.GL_FLOAT, false, 28, 0L); GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, 0);
GL46.glEnableVertexAttribArray(0); GlState.resetColor();
GL46.glVertexAttribPointer(1, 4, GL46.GL_BYTE, true, 28, 12L); this.renderChunks.clear();
GL46.glEnableVertexAttribArray(1);
GL46.glVertexAttribPointer(2, 2, GL46.GL_FLOAT, false, 28, 16L);
GL46.glEnableVertexAttribArray(2);
GL46.glVertexAttribPointer(3, 4, GL46.GL_UNSIGNED_BYTE, true, 28, 24L);
GL46.glEnableVertexAttribArray(3);
vertexbuffer.drawArrays(GL46.GL_QUADS);
GL46.glDisableVertexAttribArray(0);
GL46.glDisableVertexAttribArray(1);
GL46.glDisableVertexAttribArray(2);
GL46.glDisableVertexAttribArray(3);
} }
context.finish();
GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, 0); for (VertexFormatElement vertexformatelement : DefaultVertexFormats.BLOCK.getElements())
GlState.resetColor(); {
this.renderChunks.clear(); VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.usage();
int s = vertexformatelement.index();
switch (vertexformatelement$enumusage)
{
case POSITION:
GL46.glDisableClientState(GL46.GL_VERTEX_ARRAY);
break;
case UV:
GL46.glClientActiveTexture(GL46.GL_TEXTURE0 + s);
GL46.glDisableClientState(GL46.GL_TEXTURE_COORD_ARRAY);
GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
break;
case COLOR:
GL46.glDisableClientState(GL46.GL_COLOR_ARRAY);
GlState.resetColor();
}
}
} }
this.gm.renderer.disableLightmap(); this.gm.renderer.disableLightmap();
return l; return l;
} }
private void setupArrayPointers()
{
GL46.nglVertexPointer(3, GL46.GL_FLOAT, 28, 0L);
GL46.nglColorPointer(4, GL46.GL_UNSIGNED_BYTE, 28, 12L);
GL46.glTexCoordPointer(2, GL46.GL_FLOAT, 28, 16L);
GL46.glClientActiveTexture(GL46.GL_TEXTURE1);
GL46.glTexCoordPointer(2, GL46.GL_SHORT, 28, 24L);
GL46.glClientActiveTexture(GL46.GL_TEXTURE0);
}
private void preRenderChunk(RenderChunk renderChunkIn)
{
BlockPos blockpos = renderChunkIn.getPosition();
GL46.glTranslatef((float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
}
private void renderSkyBox(String texture) private void renderSkyBox(String texture)
{ {
GlState.disableFog(); GlState.disableFog();
@ -3235,7 +3308,7 @@ public class Renderer {
{ {
if (state.getBlock() != Blocks.air && !state.getBlock().getMaterial().isLiquid()) if (state.getBlock() != Blocks.air && !state.getBlock().getMaterial().isLiquid())
{ {
int light = brightPos == null ? 0xffffffff : getLightmapValue(this.gm.world, brightPos); int light = brightPos == null ? 0xffffffff : getLightmapValue(this.gm.world, brightPos, Facing.UP);
IBakedModel model = this.manager.getModelForState(state); IBakedModel model = this.manager.getModelForState(state);
Block block = state.getBlock(); Block block = state.getBlock();
GL46.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL46.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
@ -3292,7 +3365,7 @@ public class Renderer {
if(!list.isEmpty()) { if(!list.isEmpty()) {
BlockPos bpos = pos.offset(side); BlockPos bpos = pos.offset(side);
if(!checkSides || block.canRender(world, bpos, side)) { if(!checkSides || block.canRender(world, bpos, side)) {
int light = getLightmapValue(world, bpos); int light = getLightmapValue(world, bpos, side);
this.renderModelStandardQuads(world, block, pos, side, light, false, rb, list, bounds); this.renderModelStandardQuads(world, block, pos, side, light, false, rb, list, bounds);
rendered = true; rendered = true;
} }
@ -3305,16 +3378,45 @@ public class Renderer {
} }
return rendered; return rendered;
} }
private float getFaceBrightness(Facing side) {
switch(side) {
case DOWN:
return 0.5F;
case UP:
default:
return 1.0F;
case NORTH:
case SOUTH:
return 0.8F;
case WEST:
case EAST:
return 0.6F;
}
}
public static int getLightColor(int light) { public int getLightColor(int light, BlockPos pos, Facing side) {
return Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) << 24 | (light & 0x00ff00) | ((light >> 16) & 0xff) | ((light & 0xff) << 16); if(this.gm.useShader)
return Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) << 24 | (light & 0x00ff00) | ((light >> 16) & 0xff) | ((light & 0xff) << 16);
float sky = this.theWorld.dimension.hasSkyLight() && !this.gm.setGamma && !this.gm.xrayActive ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
Vec3 light_color = new Vec3(light);
float shading = getFaceBrightness(side);
float max = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
max = sky * (1.0f - max * this.gm.lightBlend);
float directR = Math.min((float)(light >> 16 & 0xff) / 255.0f + this.sunColorRed * max, 1.0f);
float directG = Math.min((float)(light >> 8 & 0xff) / 255.0f + this.sunColorGreen * max, 1.0f);
float directB = Math.min((float)(light & 0xff) / 255.0f + this.sunColorBlue * max, 1.0f);
// if(moon_light)
// result += calc_dir_light(norm, dir, direct, moon_direction, moon_ambient);
return 0xff000000 | (int)(directR * 255.0f) << 16 | (int)(directG * 255.0f) << 8 | (int)(directB * 255.0f);
} }
public static int componentMax(int lightA, int lightB) { public static int componentMax(int lightA, int lightB) {
return Math.max((lightA >> 16) & 0xff, (lightB >> 16) & 0xff) << 16 | Math.max((lightA >> 8) & 0xff, (lightB >> 8) & 0xff) << 8 | Math.max(lightA & 0xff, lightB & 0xff); return Math.max((lightA >> 16) & 0xff, (lightB >> 16) & 0xff) << 16 | Math.max((lightA >> 8) & 0xff, (lightB >> 8) & 0xff) << 8 | Math.max(lightA & 0xff, lightB & 0xff);
} }
private int getLightmapValue(IWorldAccess world, BlockPos pos) { private int getLightmapValue(IWorldAccess world, BlockPos pos, Facing side) {
Block block = world.getState(pos).getBlock(); Block block = world.getState(pos).getBlock();
int light = componentMax(world.getCombinedLight(pos), block.getLight()); int light = componentMax(world.getCombinedLight(pos), block.getLight());
if(light == 0 && block instanceof BlockSlab) { if(light == 0 && block instanceof BlockSlab) {
@ -3322,13 +3424,13 @@ public class Renderer {
block = world.getState(pos).getBlock(); block = world.getState(pos).getBlock();
light = componentMax(world.getCombinedLight(pos), block.getLight()); light = componentMax(world.getCombinedLight(pos), block.getLight());
} }
return getLightColor(light); return getLightColor(light, pos, side);
} }
private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos) { private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos, Facing side) {
int light = world.getCombinedLight(pos); int light = world.getCombinedLight(pos);
int up = world.getCombinedLight(pos.up()); int up = world.getCombinedLight(pos.up());
return getLightColor(componentMax(light, up)); return getLightColor(componentMax(light, up), pos, side);
} }
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags) private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
@ -3342,7 +3444,7 @@ public class Renderer {
if (ownLight) if (ownLight)
{ {
this.fillQuadBounds(blockIn, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, boundsFlags); this.fillQuadBounds(blockIn, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, boundsFlags);
light = boundsFlags.get(0) ? getLightmapValue(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : getLightmapValue(blockAccessIn, blockPosIn); light = boundsFlags.get(0) ? getLightmapValue(blockAccessIn, blockPosIn.offset(bakedquad.getFace()), bakedquad.getFace()) : getLightmapValue(blockAccessIn, blockPosIn, bakedquad.getFace());
} }
worldRendererIn.addVertexData(bakedquad.getVertexData()); worldRendererIn.addVertexData(bakedquad.getVertexData());
@ -3501,20 +3603,18 @@ public class Renderer {
f20 = textureatlassprite.getInterpolatedV((double)(8.0F + (-f22 - f21) * 16.0F)); f20 = textureatlassprite.getInterpolatedV((double)(8.0F + (-f22 - f21) * 16.0F));
} }
int k2 = getLightmapValueLiquid(blockAccess, blockPosIn); int light = getLightmapValueLiquid(blockAccess, blockPosIn, Facing.UP);
int l2 = k2 >> 16 & 65535; worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).color(light).endVertex();
int i3 = k2 & 65535; worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).color(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).color(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).color(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex();
if (blockliquid.shouldRenderSides(blockAccess, blockPosIn.up())) if (blockliquid.shouldRenderSides(blockAccess, blockPosIn.up()))
{ {
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).color(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).color(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).color(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex(); worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).color(light).endVertex();
} }
} }
@ -3524,13 +3624,11 @@ public class Renderer {
float f36 = atextureatlassprite[0].getMaxU(); float f36 = atextureatlassprite[0].getMaxU();
float f37 = atextureatlassprite[0].getMinV(); float f37 = atextureatlassprite[0].getMinV();
float f38 = atextureatlassprite[0].getMaxV(); float f38 = atextureatlassprite[0].getMaxV();
int l1 = getLightmapValueLiquid(blockAccess, blockPosIn.down()); int light = getLightmapValueLiquid(blockAccess, blockPosIn.down(), Facing.DOWN);
int i2 = l1 >> 16 & 65535; worldRendererIn.pos(d0, d1, d2 + 1.0D).normal(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f38).color(light).endVertex();
int j2 = l1 & 65535; worldRendererIn.pos(d0, d1, d2).normal(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f37).color(light).endVertex();
worldRendererIn.pos(d0, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f38).lightmap(i2, j2).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1, d2).normal(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f37).color(light).endVertex();
worldRendererIn.pos(d0, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f37).lightmap(i2, j2).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).normal(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f38).color(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f37).lightmap(i2, j2).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f38).lightmap(i2, j2).endVertex();
rendered = true; rendered = true;
} }
@ -3614,19 +3712,17 @@ public class Renderer {
float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F * 0.5F)); float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F * 0.5F));
float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F * 0.5F)); float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F * 0.5F));
float f30 = textureatlassprite1.getInterpolatedV(8.0D); float f30 = textureatlassprite1.getInterpolatedV(8.0D);
int j = getLightmapValueLiquid(blockAccess, blockpos); int light = getLightmapValueLiquid(blockAccess, blockpos, LIQUID_FACINGS[np]);
int k = j >> 16 & 65535;
int l = j & 65535;
float xn = np == 2 ? -1.0f : (np == 3 ? 1.0f : 0.0f); float xn = np == 2 ? -1.0f : (np == 3 ? 1.0f : 0.0f);
float zn = np == 0 ? -1.0f : (np == 1 ? 1.0f : 0.0f); float zn = np == 0 ? -1.0f : (np == 1 ? 1.0f : 0.0f);
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); worldRendererIn.pos(d3, d1 + (double)f39, d4).normal(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).color(light).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); worldRendererIn.pos(d5, d1 + (double)f40, d6).normal(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).color(light).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); worldRendererIn.pos(d5, d1 + 0.0D, d6).normal(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).color(light).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); worldRendererIn.pos(d3, d1 + 0.0D, d4).normal(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).color(light).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); worldRendererIn.pos(d3, d1 + 0.0D, d4).normal(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).color(light).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); worldRendererIn.pos(d5, d1 + 0.0D, d6).normal(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).color(light).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); worldRendererIn.pos(d5, d1 + (double)f40, d6).normal(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).color(light).endVertex();
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); worldRendererIn.pos(d3, d1 + (double)f39, d4).normal(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).color(light).endVertex();
} }
} }
@ -3729,20 +3825,18 @@ public class Renderer {
f16 = f15; f16 = f15;
f20 = f17; f20 = f17;
int k2 = getLightmapValueLiquid(blockAccess, blockPosIn); int light = getLightmapValueLiquid(blockAccess, blockPosIn, Facing.UP);
int l2 = k2 >> 16 & 65535; worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).color(light).endVertex();
int i3 = k2 & 65535; worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).color(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).color(light).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).color(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex();
// //
// if (block.shouldRenderSides(blockAccess, blockPosIn.up())) // if (block.shouldRenderSides(blockAccess, blockPosIn.up()))
// { // {
// worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); // worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).color(light).endVertex();
// worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex(); // worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).color(light).endVertex();
// worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex(); // worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).color(light).endVertex();
// worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex(); // worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).normal(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).color(light).endVertex();
// } // }
} }
@ -3752,13 +3846,11 @@ public class Renderer {
float f36 = textureatlassprite.getMaxU(); float f36 = textureatlassprite.getMaxU();
float f37 = textureatlassprite.getMinV(); float f37 = textureatlassprite.getMinV();
float f38 = textureatlassprite.getMaxV(); float f38 = textureatlassprite.getMaxV();
int l1 = getLightmapValueLiquid(blockAccess, blockPosIn.down()); int light = getLightmapValueLiquid(blockAccess, blockPosIn.down(), Facing.DOWN);
int i2 = l1 >> 16 & 65535; worldRendererIn.pos(d0, d1, d2 + 1.0D).normal(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f38).color(light).endVertex();
int j2 = l1 & 65535; worldRendererIn.pos(d0, d1, d2).normal(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f37).color(light).endVertex();
worldRendererIn.pos(d0, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f38).lightmap(i2, j2).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1, d2).normal(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f37).color(light).endVertex();
worldRendererIn.pos(d0, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f37).lightmap(i2, j2).endVertex(); worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).normal(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f38).color(light).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f37).lightmap(i2, j2).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f38).lightmap(i2, j2).endVertex();
rendered = true; rendered = true;
} }
@ -3842,19 +3934,17 @@ public class Renderer {
float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F)); float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F));
float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F)); float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F));
float f30 = textureatlassprite1.getInterpolatedV(16.0D); float f30 = textureatlassprite1.getInterpolatedV(16.0D);
int j = getLightmapValueLiquid(blockAccess, blockpos); int light = getLightmapValueLiquid(blockAccess, blockpos, LIQUID_FACINGS[np]);
int k = j >> 16 & 65535;
int l = j & 65535;
float xn = np == 2 ? -1.0f : (np == 3 ? 1.0f : 0.0f); float xn = np == 2 ? -1.0f : (np == 3 ? 1.0f : 0.0f);
float zn = np == 0 ? -1.0f : (np == 1 ? 1.0f : 0.0f); float zn = np == 0 ? -1.0f : (np == 1 ? 1.0f : 0.0f);
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); worldRendererIn.pos(d3, d1 + (double)f39, d4).normal(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).color(light).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); worldRendererIn.pos(d5, d1 + (double)f40, d6).normal(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).color(light).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); worldRendererIn.pos(d5, d1 + 0.0D, d6).normal(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).color(light).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); worldRendererIn.pos(d3, d1 + 0.0D, d4).normal(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).color(light).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); worldRendererIn.pos(d3, d1 + 0.0D, d4).normal(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).color(light).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); worldRendererIn.pos(d5, d1 + 0.0D, d6).normal(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).color(light).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); worldRendererIn.pos(d5, d1 + (double)f40, d6).normal(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).color(light).endVertex();
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); worldRendererIn.pos(d3, d1 + (double)f39, d4).normal(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).color(light).endVertex();
} }
} }