diff options
author | pryazha <pryadeiniv@mail.ru> | 2025-02-19 22:26:48 +0500 |
---|---|---|
committer | pryazha <pryadeiniv@mail.ru> | 2025-02-19 22:26:48 +0500 |
commit | f9ad6fa902c1167d7622ee7af2617d14b62bee21 (patch) | |
tree | 9d78792cf360ed871616a9ea66c4237018292aa7 /advanced_lighting/4.normal_mapping/shaders/normals_debug.geom | |
parent | 926cbd0d49890772f911e6a6bedb7835605ced89 (diff) |
quite a lot of changes that I, of course, are not going to describe;)
Diffstat (limited to 'advanced_lighting/4.normal_mapping/shaders/normals_debug.geom')
-rw-r--r-- | advanced_lighting/4.normal_mapping/shaders/normals_debug.geom | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/advanced_lighting/4.normal_mapping/shaders/normals_debug.geom b/advanced_lighting/4.normal_mapping/shaders/normals_debug.geom new file mode 100644 index 0000000..666c08a --- /dev/null +++ b/advanced_lighting/4.normal_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); +} |