1
0
Fork 0

fix block colors

This commit is contained in:
Sen 2025-08-29 10:45:16 +02:00
parent 2f010b35c9
commit 1e79613f2b
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
3 changed files with 26 additions and 26 deletions

View file

@ -11,12 +11,11 @@ struct light_t {
in vec3 vertex;
in vec3 normal;
in vec2 tex_coord;
in vec2 lm_coord;
in vec4 light_color;
in float brightness;
uniform vec3 cam_pos;
uniform sampler2D tex;
uniform sampler2D lightmap;
uniform vec3 specular;
uniform float shine;
uniform float max_vert_dist;
@ -77,10 +76,10 @@ 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;
float block = clamp(0.03125 + lm_coord.x * 256.0, 0.0, 1.0);
vec3 lm = block * block_ambient;
// float block = clamp(0.03125 + lm_coord.x * 256.0, 0.0, 1.0);
// vec3 lm = block * block_ambient;
vec3 rgb = texel.rgb; // * brightness;
vec3 result = rgb * lm + calc_dir_light(norm, dir, rgb * sky * (1.0 - block));
vec3 result = rgb * light_color.rgb + calc_dir_light(norm, dir, rgb * sky * (1.0 - light_color.a * 0.5));
// int l = 0;
for(int z = 0; z < n_lights; z++) {
// if(lights[z].enabled) {

View file

@ -1,12 +1,12 @@
layout (location = 0) in vec3 pos;
layout (location = 1) in vec4 norm;
layout (location = 2) in vec2 coord;
layout (location = 3) in vec2 light;
layout (location = 3) in vec4 light;
out vec3 vertex;
out vec3 normal;
out vec2 tex_coord;
out vec2 lm_coord;
out vec4 light_color;
out float brightness;
uniform mat4 model;
@ -23,6 +23,6 @@ void main() {
normal = mat3(transpose(inverse(model))) * norm.rgb;
brightness = norm.a;
tex_coord = coord;
lm_coord = light;
light_color = light;
gl_Position = projection * view * vec4(offset + nvertex, 1.0);
}