summaryrefslogtreecommitdiff
path: root/advanced_lighting/3.2.point_shadows/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'advanced_lighting/3.2.point_shadows/shaders')
-rw-r--r--advanced_lighting/3.2.point_shadows/shaders/depth.frag (renamed from advanced_lighting/3.2.point_shadows/shaders/depth.fs)3
-rw-r--r--advanced_lighting/3.2.point_shadows/shaders/depth.geom (renamed from advanced_lighting/3.2.point_shadows/shaders/depth.gs)13
-rw-r--r--advanced_lighting/3.2.point_shadows/shaders/depth.vert (renamed from advanced_lighting/3.2.point_shadows/shaders/depth.vs)3
-rw-r--r--advanced_lighting/3.2.point_shadows/shaders/shadow.frag (renamed from advanced_lighting/3.2.point_shadows/shaders/shadow.fs)6
-rw-r--r--advanced_lighting/3.2.point_shadows/shaders/shadow.vert (renamed from advanced_lighting/3.2.point_shadows/shaders/shadow.vs)7
5 files changed, 10 insertions, 22 deletions
diff --git a/advanced_lighting/3.2.point_shadows/shaders/depth.fs b/advanced_lighting/3.2.point_shadows/shaders/depth.frag
index 88fb9e6..f95c0f8 100644
--- a/advanced_lighting/3.2.point_shadows/shaders/depth.fs
+++ b/advanced_lighting/3.2.point_shadows/shaders/depth.frag
@@ -5,8 +5,7 @@ in vec4 frag_pos;
uniform vec3 light_pos;
uniform float far;
-void
-main(void)
+void main(void)
{
float light_distance = length(frag_pos.xyz-light_pos);
light_distance = light_distance/far;
diff --git a/advanced_lighting/3.2.point_shadows/shaders/depth.gs b/advanced_lighting/3.2.point_shadows/shaders/depth.geom
index 638e2b9..de39788 100644
--- a/advanced_lighting/3.2.point_shadows/shaders/depth.gs
+++ b/advanced_lighting/3.2.point_shadows/shaders/depth.geom
@@ -6,18 +6,11 @@ uniform mat4 shadow_transforms[6];
out vec4 frag_pos;
-void
-main(void)
+void main(void)
{
- for (int face = 0;
- face < 6;
- ++face)
- {
+ for (int face = 0; face < 6; ++face) {
gl_Layer = face;
- for (int vertex = 0;
- vertex < 3;
- ++vertex)
- {
+ for (int vertex = 0; vertex < 3; ++vertex) {
frag_pos = gl_in[vertex].gl_Position;
gl_Position = shadow_transforms[face]*frag_pos;
EmitVertex();
diff --git a/advanced_lighting/3.2.point_shadows/shaders/depth.vs b/advanced_lighting/3.2.point_shadows/shaders/depth.vert
index 37a3484..37ffd1b 100644
--- a/advanced_lighting/3.2.point_shadows/shaders/depth.vs
+++ b/advanced_lighting/3.2.point_shadows/shaders/depth.vert
@@ -3,8 +3,7 @@ layout(location = 0) in vec3 apos;
uniform mat4 model;
-void
-main(void)
+void main(void)
{
gl_Position = model*vec4(apos, 1.0);
}
diff --git a/advanced_lighting/3.2.point_shadows/shaders/shadow.fs b/advanced_lighting/3.2.point_shadows/shaders/shadow.frag
index 6a3a8b0..bb006ca 100644
--- a/advanced_lighting/3.2.point_shadows/shaders/shadow.fs
+++ b/advanced_lighting/3.2.point_shadows/shaders/shadow.frag
@@ -24,8 +24,7 @@ vec3 grid_sampling_disk[20] = vec3[]
vec3(0, 1, 1), vec3( 0, -1, 1), vec3( 0, -1, -1), vec3( 0, 1, -1)
);
-float
-calculate_shadow(vec3 frag_pos)
+float calculate_shadow(vec3 frag_pos)
{
vec3 frag_to_light = frag_pos-light_pos;
/* float closest_depth = texture(depth_cubemap, frag_to_light).r; */
@@ -80,8 +79,7 @@ calculate_shadow(vec3 frag_pos)
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.2.point_shadows/shaders/shadow.vs b/advanced_lighting/3.2.point_shadows/shaders/shadow.vert
index ac8ee4f..dccaa76 100644
--- a/advanced_lighting/3.2.point_shadows/shaders/shadow.vs
+++ b/advanced_lighting/3.2.point_shadows/shaders/shadow.vert
@@ -9,14 +9,13 @@ out VS_OUT {
vec2 tex_coords;
} vs_out;
-uniform mat4 projection;
+uniform mat4 proj;
uniform mat4 view;
uniform mat4 model;
uniform bool reverse_normals;
-void
-main(void)
+void main(void)
{
vs_out.frag_pos = vec3(model*vec4(apos, 1.0));
if (reverse_normals)
@@ -25,5 +24,5 @@ main(void)
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);
}