Removed unneeded branching from shaders
This commit is contained in:
parent
0e2fba6d6f
commit
c887ecfefa
@ -64,16 +64,12 @@ void main()
|
|||||||
intensity.x = INTENSITY_AMBIENT + NdotL * LIGHT_TOP_DIFFUSE;
|
intensity.x = INTENSITY_AMBIENT + NdotL * LIGHT_TOP_DIFFUSE;
|
||||||
intensity.y = 0.0;
|
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).
|
// Perform the same lighting calculation for the 2nd light source (no specular applied).
|
||||||
NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0);
|
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)
|
// compute deltas for out of print volume detection (world coordinates)
|
||||||
if (print_box.actived)
|
if (print_box.actived)
|
||||||
|
@ -34,17 +34,13 @@ void main()
|
|||||||
intensity.x = INTENSITY_AMBIENT + NdotL * LIGHT_TOP_DIFFUSE;
|
intensity.x = INTENSITY_AMBIENT + NdotL * LIGHT_TOP_DIFFUSE;
|
||||||
intensity.y = 0.0;
|
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)
|
// Perform the same lighting calculation for the 2nd light source (no specular)
|
||||||
NdotL = max(dot(normal, LIGHT_FRONT_DIR), 0.0);
|
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.
|
// Scaled to widths of the Z texture.
|
||||||
if (object_max_z > 0.0)
|
if (object_max_z > 0.0)
|
||||||
|
Loading…
Reference in New Issue
Block a user