improve visuals
This commit is contained in:
parent
c6217bf106
commit
b25dd6161a
20 changed files with 100 additions and 99 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue