From 843308f07547b969c97efc23848f4e81b50a5b24 Mon Sep 17 00:00:00 2001 From: Matt Strapp Date: Wed, 24 Nov 2021 09:18:24 -0600 Subject: Do a5 --- dev/a5-artrender/shaders/outline.vert | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'dev/a5-artrender/shaders/outline.vert') diff --git a/dev/a5-artrender/shaders/outline.vert b/dev/a5-artrender/shaders/outline.vert index 302cfeb..58e1308 100644 --- a/dev/a5-artrender/shaders/outline.vert +++ b/dev/a5-artrender/shaders/outline.vert @@ -18,5 +18,13 @@ layout(location = 2) in vec3 left_normal; layout(location = 3) in vec3 right_normal; void main() { - gl_Position = proj_matrix * model_view_matrix * vec4(vertex,1); + vec3 e = (model_view_matrix * vec4(vertex, 1.0)).xyz; + vec3 n_vertex = vertex; + vec3 ln = (normal_matrix * vec4(left_normal, 1.0)).xyz; + vec3 rn = (normal_matrix * vec4(right_normal, 1.0)).xyz; + if (dot(ln, e) * dot(rn, e) < 0.0) { + n_vertex = vertex + thickness * normal; + } + + gl_Position = proj_matrix * model_view_matrix * vec4(n_vertex,1); } -- cgit v1.2.3