Browse Source

Minor refactoring

Panagiotis Christopoulos Charitos 7 years ago
parent
commit
544a11949b
1 changed files with 8 additions and 10 deletions
  1. 8 10
      shaders/ExponentialShadowmappingResolve.glslp

+ 8 - 10
shaders/ExponentialShadowmappingResolve.glslp

@@ -81,8 +81,9 @@ void main()
 {
 {
 	const Vec2 UV_OFFSET = OFFSET * TEXEL_SIZE;
 	const Vec2 UV_OFFSET = OFFSET * TEXEL_SIZE;
 
 
-	if(u_renderingTechnique == 0u)
+	switch(u_renderingTechnique)
 	{
 	{
+	case 0u:
 		out_color = sampleLinearDepthPerspective(in_uv) * BOX_WEIGHTS[0u];
 		out_color = sampleLinearDepthPerspective(in_uv) * BOX_WEIGHTS[0u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(UV_OFFSET.x, 0.0)) * BOX_WEIGHTS[1u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(UV_OFFSET.x, 0.0)) * BOX_WEIGHTS[1u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(-UV_OFFSET.x, 0.0)) * BOX_WEIGHTS[1u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(-UV_OFFSET.x, 0.0)) * BOX_WEIGHTS[1u];
@@ -92,13 +93,11 @@ void main()
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(-UV_OFFSET.x, UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(-UV_OFFSET.x, UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(UV_OFFSET.x, -UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(UV_OFFSET.x, -UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(-UV_OFFSET.x, -UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthPerspective(in_uv + Vec2(-UV_OFFSET.x, -UV_OFFSET.y)) * BOX_WEIGHTS[2u];
-	}
-	else if(u_renderingTechnique == 1u)
-	{
+		break;
+	case 1u:
 		out_color = sampleLinearDepthPerspective(in_uv);
 		out_color = sampleLinearDepthPerspective(in_uv);
-	}
-	else if(u_renderingTechnique == 2u)
-	{
+		break;
+	case 2u:
 		out_color = sampleLinearDepthOrhographic(in_uv) * BOX_WEIGHTS[0u];
 		out_color = sampleLinearDepthOrhographic(in_uv) * BOX_WEIGHTS[0u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(UV_OFFSET.x, 0.0)) * BOX_WEIGHTS[1u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(UV_OFFSET.x, 0.0)) * BOX_WEIGHTS[1u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(-UV_OFFSET.x, 0.0)) * BOX_WEIGHTS[1u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(-UV_OFFSET.x, 0.0)) * BOX_WEIGHTS[1u];
@@ -108,9 +107,8 @@ void main()
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(-UV_OFFSET.x, UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(-UV_OFFSET.x, UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(UV_OFFSET.x, -UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(UV_OFFSET.x, -UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(-UV_OFFSET.x, -UV_OFFSET.y)) * BOX_WEIGHTS[2u];
 		out_color += sampleLinearDepthOrhographic(in_uv + Vec2(-UV_OFFSET.x, -UV_OFFSET.y)) * BOX_WEIGHTS[2u];
-	}
-	else
-	{
+		break;
+	default:
 		out_color = sampleLinearDepthOrhographic(in_uv);
 		out_color = sampleLinearDepthOrhographic(in_uv);
 	}
 	}
 }
 }