diff options
author | enricoturri1966 <enricoturri@seznam.cz> | 2020-04-08 09:22:02 +0300 |
---|---|---|
committer | enricoturri1966 <enricoturri@seznam.cz> | 2020-04-08 09:22:02 +0300 |
commit | c887ecfefaeb627f656f4bc007f897b027dcf90a (patch) | |
tree | 0312fc9f5ed60c495c277d299b4141d687e94cf1 /resources | |
parent | 0e2fba6d6f07f515620483405021f8c83fba0080 (diff) |
Removed unneeded branching from shaders
Diffstat (limited to 'resources')
-rw-r--r-- | resources/shaders/gouraud.vs | 10 | ||||
-rw-r--r-- | resources/shaders/variable_layer_height.vs | 10 |
2 files changed, 6 insertions, 14 deletions
diff --git a/resources/shaders/gouraud.vs b/resources/shaders/gouraud.vs index 17cc764e2..a790b5d9e 100644 --- a/resources/shaders/gouraud.vs +++ b/resources/shaders/gouraud.vs @@ -64,16 +64,12 @@ void main() intensity.x = INTENSITY_AMBIENT + NdotL * LIGHT_TOP_DIFFUSE; intensity.y = 0.0; - if (NdotL > 0.0) - { - vec3 position = (gl_ModelViewMatrix * gl_Vertex).xyz; - intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(position), reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); - } + vec3 position = (gl_ModelViewMatrix * gl_Vertex).xyz; + intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(position), reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); // Perform the same lighting calculation for the 2nd light source (no specular applied). NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0); - if (NdotL > 0.0) - intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; + intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; // compute deltas for out of print volume detection (world coordinates) if (print_box.actived) diff --git a/resources/shaders/variable_layer_height.vs b/resources/shaders/variable_layer_height.vs index 5dd697063..221cb5407 100644 --- a/resources/shaders/variable_layer_height.vs +++ b/resources/shaders/variable_layer_height.vs @@ -34,17 +34,13 @@ void main() intensity.x = INTENSITY_AMBIENT + NdotL * LIGHT_TOP_DIFFUSE; intensity.y = 0.0; - if (NdotL > 0.0) - { - vec3 position = (gl_ModelViewMatrix * gl_Vertex).xyz; - intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(position), reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); - } + vec3 position = (gl_ModelViewMatrix * gl_Vertex).xyz; + intensity.y += LIGHT_TOP_SPECULAR * pow(max(dot(-normalize(position), reflect(-LIGHT_TOP_DIR, normal)), 0.0), LIGHT_TOP_SHININESS); // Perform the same lighting calculation for the 2nd light source (no specular) NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0); - if (NdotL > 0.0) - intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; + intensity.x += NdotL * LIGHT_FRONT_DIFFUSE; // Scaled to widths of the Z texture. if (object_max_z > 0.0) |