Give few more fps in GLES renderer by pre-computing diffuse/specular color

This commit is contained in:
Deve
2017-03-28 22:05:51 +02:00
parent 0123228c20
commit af98b526d6
2 changed files with 6 additions and 5 deletions

View File

@@ -14,10 +14,6 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
#if defined(GL_ES) && !defined(Advanced_Lighting_Enabled)
DiffuseComponent = pow(DiffuseComponent, vec3(1. / 2.2));
SpecularComponent = pow(SpecularComponent, vec3(1. / 2.2));
#endif
vec3 tmp = diffuseMatColor * DiffuseComponent * (1. - specMapValue) + specularMatColor * SpecularComponent * specMapValue;
vec3 emitCol = diffuseMatColor.xyz * diffuseMatColor.xyz * diffuseMatColor.xyz * 15.;
return tmp * ao + (emitMapValue * emitCol);

View File

@@ -293,7 +293,12 @@ RTT::RTT(size_t width, size_t height, float rtt_scale)
glClear(GL_COLOR_BUFFER_BIT);
getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).bind();
glClearColor(.5, .5, .5, .5);
float color = 0.5;
#if defined(USE_GLES2)
if (!CVS->isDefferedEnabled())
color = pow(color, 1. / 2.2);
#endif
glClearColor(color, color, color, color);
glClear(GL_COLOR_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#if !defined(USE_GLES2)