Shader speed optimization

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4028
This commit is contained in:
kearwood
2012-04-05 21:52:09 +00:00
parent 03b749b93c
commit 384068eb9c
2 changed files with 3 additions and 6 deletions

View File

@@ -110,7 +110,7 @@ void main()
mediump float lamberFactor = max(0.0,dot(lightVec, normal));
mediump float specularFactor = 0.0;
//if(material_shininess > 0.0) {
specularFactor = max(0.0,pow(max(dot(halfVec,normal), 0.0), material_shininess));
specularFactor = max(0.0,pow(dot(halfVec,normal), material_shininess));
//}
#endif
@@ -129,7 +129,7 @@ void main()
#if DEBUG_PSSM == 1
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.75, 0.5, 1.0) + vec4(0.0, 0.0, 0.5, 0.0);
#endif
shadowMapDepth = texture2D(shadowTexture1, shadowMapPos).z; // unpack(texture2D(shadowTexture1, shadowMapPos));
shadowMapDepth = texture2D(shadowTexture1, shadowMapPos).z;
vertexShadowDepth = ((shadowMapCoord1 / shadowMapCoord1.w + 1.0) / 2.0).z;
}
#endif

View File

@@ -208,10 +208,7 @@ void main()
// ------ Calculate per-vertex lighting ------
mediump vec3 halfVec = normalize((normalize(cameraPosition - myVertex) + lightDirection)); // Normalizing anyways, no need to divide by 2
lamberFactor = max(0.0,dot(lightDirection, myNormal));
specularFactor = 0.0;
if(material_shininess > 0.0) {
specularFactor = max(0.0,pow(dot(halfVec,myNormal), material_shininess));
}
#endif
#endif
}