summaryrefslogtreecommitdiff
path: root/advanced_lighting/5.parallax_mapping/shaders/normals_debug.geom
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-03-18 11:31:31 +0500
committerpryazha <pryadeiniv@mail.ru>2025-03-18 11:31:31 +0500
commitd65ddd07a43d5ffdcf2ddf90d6f86626cf9b92d8 (patch)
tree672efce6089ec9c1103be0c1b70a28ec415eeeab /advanced_lighting/5.parallax_mapping/shaders/normals_debug.geom
parentd64a159d05a45e75870f61c37f0defa94f03793e (diff)
Diffstat (limited to 'advanced_lighting/5.parallax_mapping/shaders/normals_debug.geom')
-rw-r--r--advanced_lighting/5.parallax_mapping/shaders/normals_debug.geom44
1 files changed, 44 insertions, 0 deletions
diff --git a/advanced_lighting/5.parallax_mapping/shaders/normals_debug.geom b/advanced_lighting/5.parallax_mapping/shaders/normals_debug.geom
new file mode 100644
index 0000000..79fd4f6
--- /dev/null
+++ b/advanced_lighting/5.parallax_mapping/shaders/normals_debug.geom
@@ -0,0 +1,44 @@
+#version 330 core
+layout(triangles) in;
+layout(line_strip, max_vertices=18) out;
+
+in VS_OUT {
+ vec4 tangent;
+ vec4 bitangent;
+ vec4 normal;
+} gs_in[];
+
+out vec3 vcolor;
+
+uniform mat4 proj;
+
+void gen_normals(int index)
+{
+ vcolor = vec3(1.0, 0.0, 0.0);
+ gl_Position = proj*(gl_in[index].gl_Position);
+ EmitVertex();
+ gl_Position = proj*(gl_in[index].gl_Position+0.5*gs_in[index].tangent);
+ EmitVertex();
+ EndPrimitive();
+
+ vcolor = vec3(0.0, 0.0, 1.0);
+ gl_Position = proj*(gl_in[index].gl_Position);
+ EmitVertex();
+ gl_Position = proj*(gl_in[index].gl_Position+0.5*gs_in[index].bitangent);
+ EmitVertex();
+ EndPrimitive();
+
+ vcolor = vec3(0.0, 1.0, 0.0);
+ gl_Position = proj*(gl_in[index].gl_Position);
+ EmitVertex();
+ gl_Position = proj*(gl_in[index].gl_Position+0.5*gs_in[index].normal);
+ EmitVertex();
+ EndPrimitive();
+}
+
+void main(void)
+{
+ gen_normals(0);
+ gen_normals(1);
+ gen_normals(2);
+}