summaryrefslogtreecommitdiff
path: root/advanced_lighting/3.1.shadow_mapping/shaders
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-02-19 22:26:48 +0500
committerpryazha <pryadeiniv@mail.ru>2025-02-19 22:26:48 +0500
commitf9ad6fa902c1167d7622ee7af2617d14b62bee21 (patch)
tree9d78792cf360ed871616a9ea66c4237018292aa7 /advanced_lighting/3.1.shadow_mapping/shaders
parent926cbd0d49890772f911e6a6bedb7835605ced89 (diff)
quite a lot of changes that I, of course, are not going to describe;)
Diffstat (limited to 'advanced_lighting/3.1.shadow_mapping/shaders')
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/color.frag (renamed from advanced_lighting/3.1.shadow_mapping/shaders/color.fs)3
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/color.vert (renamed from advanced_lighting/3.1.shadow_mapping/shaders/color.vs)7
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.frag (renamed from advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.fs)6
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.vert (renamed from advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.vs)0
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/shadow.frag (renamed from advanced_lighting/3.1.shadow_mapping/shaders/shadow.fs)6
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/shadow.vert (renamed from advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs)7
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.frag (renamed from advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.fs)3
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.vert (renamed from advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.vs)3
8 files changed, 13 insertions, 22 deletions
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/color.fs b/advanced_lighting/3.1.shadow_mapping/shaders/color.frag
index bd00d82..c01da99 100644
--- a/advanced_lighting/3.1.shadow_mapping/shaders/color.fs
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/color.frag
@@ -2,8 +2,7 @@
out vec4 frag_color;
-void
-main(void)
+void main(void)
{
frag_color = vec4(1.0);
}
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/color.vs b/advanced_lighting/3.1.shadow_mapping/shaders/color.vert
index ade669b..6aa621e 100644
--- a/advanced_lighting/3.1.shadow_mapping/shaders/color.vs
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/color.vert
@@ -1,12 +1,11 @@
#version 330 core
layout(location = 0) in vec3 apos;
-uniform mat4 projection;
+uniform mat4 proj;
uniform mat4 view;
uniform mat4 model;
-void
-main(void)
+void main(void)
{
- gl_Position = projection*view*model*vec4(apos, 1.0);
+ gl_Position = proj * view * model * vec4(apos, 1.0);
}
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.fs b/advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.frag
index d250894..4cb6df1 100644
--- a/advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.fs
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.frag
@@ -8,15 +8,13 @@ uniform sampler2D depth_map;
uniform float near;
uniform float far;
-float
-linearize_depth(float depth)
+float linearize_depth(float depth)
{
float z = (depth+1.0)*0.5;
return((2.0*near*far)/(far+near-z*(far-near)));
}
-void
-main(void)
+void main(void)
{
float depth = texture(depth_map, tex_coords).r;
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.vs b/advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.vert
index 5717608..5717608 100644
--- a/advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.vs
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/debug_quad.vert
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/shadow.fs b/advanced_lighting/3.1.shadow_mapping/shaders/shadow.frag
index 1c7018a..3403d1d 100644
--- a/advanced_lighting/3.1.shadow_mapping/shaders/shadow.fs
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/shadow.frag
@@ -15,8 +15,7 @@ uniform vec3 view_pos;
uniform sampler2D diffuse_texture;
uniform sampler2D shadow_map;
-float
-calculate_shadow()
+float calculate_shadow()
{
vec3 proj_coords = fs_in.frag_pos_light_space.xyz/fs_in.frag_pos_light_space.w;
proj_coords = proj_coords*0.5+0.5;
@@ -43,8 +42,7 @@ calculate_shadow()
return(shadow);
}
-void
-main(void)
+void main(void)
{
vec3 color = texture(diffuse_texture, fs_in.tex_coords).rgb;
vec3 normal = normalize(fs_in.normal);
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs b/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vert
index 3ecd5b1..3f14663 100644
--- a/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vert
@@ -10,17 +10,16 @@ out VS_OUT {
vec2 tex_coords;
} vs_out;
-uniform mat4 projection;
+uniform mat4 proj;
uniform mat4 view;
uniform mat4 model;
uniform mat4 light_space_matrix;
-void
-main(void)
+void main(void)
{
vs_out.frag_pos = vec3(model*vec4(apos, 1.0));
vs_out.frag_pos_light_space = light_space_matrix*vec4(vs_out.frag_pos, 1.0);
vs_out.normal = mat3(transpose(inverse(model)))*anormal;
vs_out.tex_coords = atex_coords;
- gl_Position = projection*view*vec4(vs_out.frag_pos, 1.0);
+ gl_Position = proj*view*vec4(vs_out.frag_pos, 1.0);
}
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.fs b/advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.frag
index 16b9908..d99aab2 100644
--- a/advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.fs
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.frag
@@ -1,6 +1,5 @@
#version 330 core
-void
-main(void)
+void main(void)
{
}
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.vs b/advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.vert
index b9752ed..d3adca9 100644
--- a/advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.vs
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/simple_depth.vert
@@ -4,8 +4,7 @@ layout(location = 0) in vec3 apos;
uniform mat4 light_space_matrix;
uniform mat4 model;
-void
-main(void)
+void main(void)
{
gl_Position = light_space_matrix*model*vec4(apos, 1.0);
}