fix block colors
This commit is contained in:
parent
2f010b35c9
commit
1e79613f2b
3 changed files with 26 additions and 26 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue