1
0
Fork 0

improve visuals

This commit is contained in:
Sen 2025-08-30 09:07:15 +02:00
parent b25dd6161a
commit e3e5fbd7fd
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
15 changed files with 31 additions and 64 deletions

View file

@ -3874,6 +3874,8 @@ public class Renderer {
int i = 0;
float f = 0.0F;
int n = 0;
int a = 0;
int s = 0;
for (int j = 0; j < 4; ++j)
{
@ -3893,14 +3895,16 @@ public class Renderer {
if (!material.isNonBlock()) // material != block
{
if (material == Blocks.air)
if (!material.canConnectNonBlock())
{
++a;
f += 4;
++i;
}
}
else
{
++s;
f += 1.0F / 9.0f;
i += 10;
@ -3909,6 +3913,6 @@ public class Renderer {
}
}
return n == 4 ? 1.0f : 1.0F - f / (float)i;
return n == 4 ? 1.0f : (s + a == 4 && a > 1 ? 0.0f : 1.0F - f / (float)i);
}
}

View file

@ -57,7 +57,7 @@ public enum Shader {
context.integer("n_lights", 0);
context.color3("specular", Client.CLIENT.specularColors && !Client.CLIENT.setGamma && !Client.CLIENT.xrayActive ? 0xffffff : 0x000000);
context.bool("shade", Client.CLIENT.flatShading);
context.bool("shade", Client.CLIENT.flatShading || Client.CLIENT.setGamma || Client.CLIENT.xrayActive);
GlState.setActiveTexture(GL46.GL_TEXTURE0);
// glBindBufferBase(GL_UNIFORM_BUFFER, 0, world->light_buf);

View file

@ -31,8 +31,6 @@ import common.util.Vec3i;
public class RenderItem
{
private static final String RES_ITEM_GLINT = "textures/glint.png";
private final ItemModelMesher mesher;
private final TextureManager manager;
private final LayerArmor armor = new LayerArmor(null, 12, 12) {
@ -99,11 +97,6 @@ public class RenderItem
{
GL46.glTranslatef(-0.5F, -0.5F, -0.5F);
this.renderModel(model, stack);
if (stack.getItem().isGleaming(stack))
{
this.renderEffect(model);
}
}
GL46.glPopMatrix();
@ -171,36 +164,6 @@ public class RenderItem
}
}
private void renderEffect(IBakedModel model)
{
GlState.depthMask(false);
GlState.depthFunc(GL46.GL_EQUAL);
GlState.disableLighting();
GlState.blendFunc(GL46.GL_SRC_COLOR, GL46.GL_ONE);
this.manager.bindTexture(RES_ITEM_GLINT);
GL46.glMatrixMode(GL46.GL_TEXTURE);
GL46.glPushMatrix();
GL46.glScalef(8.0F, 8.0F, 8.0F);
float f = (float)(System.currentTimeMillis() % 3000L) / 3000.0F / 8.0F;
GL46.glTranslatef(f, 0.0F, 0.0F);
GL46.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
this.renderModel(model, -8372020);
GL46.glPopMatrix();
GL46.glPushMatrix();
GL46.glScalef(8.0F, 8.0F, 8.0F);
float f1 = (float)(System.currentTimeMillis() % 4873L) / 4873.0F / 8.0F;
GL46.glTranslatef(-f1, 0.0F, 0.0F);
GL46.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
this.renderModel(model, -8372020);
GL46.glPopMatrix();
GL46.glMatrixMode(GL46.GL_MODELVIEW);
GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA);
GlState.enableLighting();
GlState.depthFunc(GL46.GL_LEQUAL);
GlState.depthMask(true);
this.manager.bindTexture(TextureMap.BLOCKS);
}
private void putQuadNormal(RenderBuffer renderer, BakedQuad quad)
{
Vec3i vec3i = quad.getFace().getDirectionVec();

View file

@ -22,7 +22,7 @@ uniform bool shade;
void main() {
vec3 nvertex = vec3(model * vec4(pos, 1.0));
vertex = vec3(float(chunk_x) + pos.x, float(chunk_y) + pos.y, float(chunk_z) + pos.z);
shading = shade ? (norm.x != 0.0 ? 0.6 : (norm.z != 0.0 ? 0.8 : (norm.y < 0.0 ? 0.5 : 1.0))) : 1.0;
shading = shade ? (norm.x != 0.0 ? 0.6 : (norm.z != 0.0 ? 0.8 : (norm.y > 0.0 ? 0.5 : 1.0))) : 1.0;
normal = mat3(transpose(inverse(model))) * norm.xyz;
shine = norm.a * 32.0;
tex_coord = coord;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 992 B