diff options
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_edges_front_back_persp_vert.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_edges_front_back_persp_vert.glsl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_edges_front_back_persp_vert.glsl b/source/blender/gpu/shaders/gpu_shader_edges_front_back_persp_vert.glsl index e1fb78dd1a9..c8b722e1d7e 100644 --- a/source/blender/gpu/shaders/gpu_shader_edges_front_back_persp_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_edges_front_back_persp_vert.glsl @@ -14,7 +14,7 @@ uniform mat4 ModelViewMatrix; uniform mat3 NormalMatrix; in vec3 pos; -in vec3 N1, N2; // normals of faces this edge joins (object coords) +in vec3 N1, N2; // normals of faces this edge joins (object coords) out vec4 MV_pos; out float edgeClass; @@ -23,22 +23,22 @@ out float edgeClass; bool front(vec3 N, vec3 eye) { - return dot(NormalMatrix * N, eye) > 0.0; + return dot(NormalMatrix * N, eye) > 0.0; } void main() { - MV_pos = ModelViewMatrix * vec4(pos, 1.0); + MV_pos = ModelViewMatrix * vec4(pos, 1.0); - vec3 eye = normalize(-MV_pos.xyz); + vec3 eye = normalize(-MV_pos.xyz); - bool face_1_front = front(N1, eye); - bool face_2_front = front(N2, eye); + bool face_1_front = front(N1, eye); + bool face_2_front = front(N2, eye); - if (face_1_front && face_2_front) - edgeClass = 1.0; // front-facing edge - else if (face_1_front || face_2_front) - edgeClass = 0.0; // exactly one face is front-facing, silhouette edge - else - edgeClass = -1.0; // back-facing edge + if (face_1_front && face_2_front) + edgeClass = 1.0; // front-facing edge + else if (face_1_front || face_2_front) + edgeClass = 0.0; // exactly one face is front-facing, silhouette edge + else + edgeClass = -1.0; // back-facing edge } |