Shader speed optimization
--HG-- extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4028
This commit is contained in:
@@ -110,7 +110,7 @@ void main()
|
|||||||
mediump float lamberFactor = max(0.0,dot(lightVec, normal));
|
mediump float lamberFactor = max(0.0,dot(lightVec, normal));
|
||||||
mediump float specularFactor = 0.0;
|
mediump float specularFactor = 0.0;
|
||||||
//if(material_shininess > 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
|
#endif
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ void main()
|
|||||||
#if DEBUG_PSSM == 1
|
#if DEBUG_PSSM == 1
|
||||||
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.75, 0.5, 1.0) + vec4(0.0, 0.0, 0.5, 0.0);
|
diffuseMaterial = diffuseMaterial * vec4(0.75, 0.75, 0.5, 1.0) + vec4(0.0, 0.0, 0.5, 0.0);
|
||||||
#endif
|
#endif
|
||||||
shadowMapDepth = texture2D(shadowTexture1, shadowMapPos).z; // unpack(texture2D(shadowTexture1, shadowMapPos));
|
shadowMapDepth = texture2D(shadowTexture1, shadowMapPos).z;
|
||||||
vertexShadowDepth = ((shadowMapCoord1 / shadowMapCoord1.w + 1.0) / 2.0).z;
|
vertexShadowDepth = ((shadowMapCoord1 / shadowMapCoord1.w + 1.0) / 2.0).z;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -208,10 +208,7 @@ void main()
|
|||||||
// ------ Calculate per-vertex lighting ------
|
// ------ Calculate per-vertex lighting ------
|
||||||
mediump vec3 halfVec = normalize((normalize(cameraPosition - myVertex) + lightDirection)); // Normalizing anyways, no need to divide by 2
|
mediump vec3 halfVec = normalize((normalize(cameraPosition - myVertex) + lightDirection)); // Normalizing anyways, no need to divide by 2
|
||||||
lamberFactor = max(0.0,dot(lightDirection, myNormal));
|
lamberFactor = max(0.0,dot(lightDirection, myNormal));
|
||||||
specularFactor = 0.0;
|
specularFactor = max(0.0,pow(dot(halfVec,myNormal), material_shininess));
|
||||||
if(material_shininess > 0.0) {
|
|
||||||
specularFactor = max(0.0,pow(dot(halfVec,myNormal), material_shininess));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user