feat: post-processing effects

This commit is contained in:
MihailRis
2025-04-05 00:41:25 +03:00
parent 22e97b1766
commit ba170035ef
19 changed files with 216 additions and 84 deletions
+3 -1
View File
@@ -5,10 +5,12 @@
"main",
"lines",
"entity",
"screen",
"background",
"skybox_gen"
],
"post-effects": [
"default"
],
"textures": [
"gui/menubg",
"gui/delete_icon",
+13
View File
@@ -0,0 +1,13 @@
in vec2 v_uv;
out vec4 f_color;
uniform sampler2D u_screen;
uniform ivec2 u_screenSize;
uniform float u_intensity;
#include <__effect__>
void main() {
f_color = effect();
}
@@ -1,13 +1,10 @@
layout (location = 0) in vec2 v_position;
out vec2 v_coord;
out vec2 v_uv;
uniform ivec2 u_screenSize;
uniform float u_timer;
uniform float u_dayTime;
void main(){
v_coord = v_position * 0.5 + 0.5;
v_uv = v_position * 0.5 + 0.5;
gl_Position = vec4(v_position, 0.0, 1.0);
}
+3
View File
@@ -0,0 +1,3 @@
vec4 effect() {
return texture(u_screen, v_uv);
}
-25
View File
@@ -1,25 +0,0 @@
in vec2 v_coord;
out vec4 f_color;
uniform sampler2D u_texture0;
uniform ivec2 u_screenSize;
// Vignette
vec4 apply_vignette(vec4 color) {
vec2 position = (gl_FragCoord.xy / u_screenSize) - vec2(0.5);
float dist = length(position);
float radius = 1.3;
float softness = 1.0;
float vignette = smoothstep(radius, radius - softness, dist);
color.rgb = color.rgb * vignette;
return color;
}
void main() {
f_color = texture(u_texture0, v_coord);
f_color = apply_vignette(f_color);
}