diff options
Diffstat (limited to '')
-rw-r--r-- | dev/a5-artrender/shaders/outline.vert | 10 |
1 files changed, 9 insertions, 1 deletions
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); } |