1
0
Fork 0

improve visuals

This commit is contained in:
Sen 2025-08-29 23:48:34 +02:00
parent c6217bf106
commit b25dd6161a
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
20 changed files with 100 additions and 99 deletions

View file

@ -724,6 +724,8 @@ public class Client implements IThreadListener {
private boolean textureFiltering = true;
@Variable(name = "gl_specular", category = CVarCategory.RENDER, display = "Beleuchtungseffekte")
public boolean specularColors = true;
@Variable(name = "gl_flat_shading", category = CVarCategory.RENDER, display = "Flaches Shading")
public boolean flatShading = false;
public static final Client CLIENT = new Client();

View file

@ -30,10 +30,12 @@ public class GuiGraphics extends GuiOptions {
this.addSelector("gl_light_blend", 0, 220, 240, 0);
this.addSelector("gl_specular", 242, 220, 240, 0);
this.addSelector("gl_tex_filter", 0, 240, 240, 0);
this.addSelector("gl_tex_mipmaps", 242, 240, 240, 0);
this.addSelector("gl_flat_shading", 0, 240, 240, 0);
this.addSelector("gl_tex_filter", 0, 260, 240, 0);
this.addSelector("gl_tex_mipmaps", 242, 260, 240, 0);
this.addSelector("gl_tex_anisotropic", 0, 260, 240, 0);
this.addSelector("gl_tex_anisotropic", 0, 280, 240, 0);
super.init(width, height);
}

View file

@ -57,6 +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);
GlState.setActiveTexture(GL46.GL_TEXTURE0);
// glBindBufferBase(GL_UNIFORM_BUFFER, 0, world->light_buf);

View file

@ -17,6 +17,7 @@ in vec3 normal;
in vec2 tex_coord;
in vec4 light_color;
in float shine;
in float shading;
uniform vec3 cam_pos;
uniform sampler2D tex;
@ -112,7 +113,7 @@ void main() {
vec3 dir = normalize(cam_pos - vertex);
vec4 texel = texture(tex, tex_coord);
float sky = sky_light ? vertex.y < 0.0 ? 0.0 : (vertex.y < 64.0 ? vertex.y / 64.0 : 1.0) : 1.0;
vec3 rgb = texel.rgb;
vec3 rgb = texel.rgb * shading;
vec3 direct = rgb * sky * (1.0 - light_color.a * light_factor);
vec3 result = rgb * light_color.rgb + calc_dir_light(norm, dir, direct, sun_direction, sun_ambient);
if(moon_light)

View file

@ -8,6 +8,7 @@ out vec3 normal;
out vec2 tex_coord;
out vec4 light_color;
out float shine;
out float shading;
uniform mat4 model;
uniform mat4 view;
@ -16,11 +17,13 @@ uniform vec3 offset;
uniform int chunk_x;
uniform int chunk_y;
uniform int chunk_z;
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);
normal = mat3(transpose(inverse(model))) * norm.rgb;
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;
light_color = light;

View file

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 638 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

View file

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 735 B

Before After
Before After