1
0
Fork 0

fix shaders

This commit is contained in:
Sen 2025-09-01 10:56:29 +02:00
parent a4597b437b
commit 3559a9c78b
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
13 changed files with 315 additions and 357 deletions

View file

@ -1,9 +0,0 @@
out vec4 FragColor;
in vec2 tex_coord;
uniform sampler2D tex;
void main() {
FragColor = texture(tex, tex_coord);
}

View file

@ -1,8 +0,0 @@
layout (location = 0) in vec2 coords;
out vec2 tex_coord;
void main() {
tex_coord = coords;
gl_Position = vec4(coords * 2.0 - 1.0, 0.0, 1.0);
}

View file

@ -2,14 +2,6 @@
#define GLM_SQRT2 1.41421356237309504880168872420969808
#define vis_div 24.0
out vec4 FragColor;
in vec3 vertex;
in vec2 tex_coord;
uniform vec2 tex_mul;
uniform float time;
float v2rand(vec2 uv) {
return fract(sin(dot(uv, vec2(12.9898,78.233))) * 43758.5453123);
}
@ -36,5 +28,5 @@ void main() {
vec2 shift = vec2(v2rand(coord + fract(time)) * 2.0 - 1.0, v2rand(coord + 0.5 + fract(time)) * 2.0 - 1.0);
shift = vec2(dgauss(shift.x, 0.0, 1.0), dgauss(shift.y, 0.0, 1.0)) * 0.015;
vec3 cl = vec3(inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 1.0, 3.0, 1.0, 3.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 63.0, 1.0, 63.0, 1.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 61.0, 63.0, 61.0, 63.0));
FragColor = vec4(mix(vec3(0.0, 0.0, clamp(0.1 + 0.2 * (vertex.y + 64.0) / 128.0, 0.0, 1.0)), cl, clamp(cl.x + cl.y + cl.z, 0.0, 1.0)), 1.0);
gl_FragColor = vec4(mix(vec3(0.0, 0.0, clamp(0.1 + 0.2 * (vertex.y + 64.0) / 128.0, 0.0, 1.0)), cl, clamp(cl.x + cl.y + cl.z, 0.0, 1.0)), 1.0);
}

View file

@ -1,22 +0,0 @@
layout (location = 0) in vec3 pos;
layout (location = 1) in vec4 color;
layout (location = 2) in vec2 coord;
layout (location = 3) in vec4 light;
out vec3 vertex;
out vec2 tex_coord;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform vec3 offset;
uniform int chunk_x;
uniform int chunk_y;
uniform int chunk_z;
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);
tex_coord = coord;
gl_Position = projection * view * vec4(offset + nvertex, 1.0);
}

View file

@ -1,7 +1,3 @@
out vec4 FragColor;
in float ypos;
void main() {
FragColor = vec4(clamp(-0.3 + 1.8 * (ypos + 64.0) / 128.0, 0.0, 1.0), clamp(-0.7 + 2.2 * (ypos + 64.0) / 128.0, 0.0, 1.0), clamp(0.1 + 2.0 * (ypos + 64.0) / 128.0, 0.0, 1.0), 1.0);
gl_FragColor = vec4(clamp(-0.3 + 1.8 * (vertex.y + 64.0) / 128.0, 0.0, 1.0), clamp(-0.7 + 2.2 * (vertex.y + 64.0) / 128.0, 0.0, 1.0), clamp(0.1 + 2.0 * (vertex.y + 64.0) / 128.0, 0.0, 1.0), 1.0);
}

View file

@ -1,17 +0,0 @@
layout (location = 0) in vec3 pos;
layout (location = 1) in vec4 color;
layout (location = 2) in vec2 coord;
layout (location = 3) in vec2 light;
out float ypos;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform vec3 offset;
void main() {
vec3 vertex = offset + vec3(model * vec4(pos, 1.0));
ypos = vertex.y;
gl_Position = projection * view * vec4(vertex, 1.0);
}