diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-07-02 00:09:36 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-07-02 00:09:36 -0300 |
commit | e9da61411a6f1c993d528b659ebb3e5147aa44cc (patch) | |
tree | 9aec099f021920e3c61835f1152616e2a8194351 /drivers/gles2/shaders | |
parent | 77a15e2a3e1231bf9ba011af9ee10afe5fae17dd (diff) |
Fixed Bugs & Joypad in Android
================================
-resolved many graphical glitches with multiple lights in GLES2 render
-fixes and WIP apk expansion
-joystick support for Android by Ariel
Diffstat (limited to 'drivers/gles2/shaders')
-rw-r--r-- | drivers/gles2/shaders/material.glsl | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl index b667e9176c..17365ea264 100644 --- a/drivers/gles2/shaders/material.glsl +++ b/drivers/gles2/shaders/material.glsl @@ -1060,7 +1060,19 @@ LIGHT_SHADER_CODE light+=specular * light_specular * pow( eye_light, specular_exp ); } #endif - diffuse.rgb = ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation; + diffuse.rgb = const_light_mult * ambient_light *diffuse.rgb + light * attenuation * shadow_attenuation; + +#ifdef USE_FOG + + diffuse.rgb = mix(diffuse.rgb,fog_interp.rgb,fog_interp.a); + +# if defined(LIGHT_TYPE_OMNI) || defined (LIGHT_TYPE_SPOT) + diffuse.rgb = mix(mix(vec3(0.0),diffuse.rgb,attenuation),diffuse.rgb,const_light_mult); +# endif + + +#endif + } @@ -1084,9 +1096,10 @@ LIGHT_SHADER_CODE #ifdef USE_VERTEX_LIGHTING - vec3 ambient = ambient_light*diffuse.rgb; + vec3 ambient = const_light_mult*ambient_light*diffuse.rgb; # if defined(LIGHT_TYPE_OMNI) || defined (LIGHT_TYPE_SPOT) ambient*=diffuse_interp.a; //attenuation affects ambient too + # endif // diffuse.rgb=(diffuse.rgb * diffuse_interp.rgb + specular * specular_interp)*shadow_attenuation + ambient; @@ -1094,6 +1107,16 @@ LIGHT_SHADER_CODE diffuse.rgb=(diffuse.rgb * diffuse_interp.rgb + specular * specular_interp)*shadow_attenuation + ambient; diffuse.rgb+=emission * const_light_mult; +#ifdef USE_FOG + + diffuse.rgb = mix(diffuse.rgb,fog_interp.rgb,fog_interp.a); + +# if defined(LIGHT_TYPE_OMNI) || defined (LIGHT_TYPE_SPOT) + diffuse.rgb = mix(mix(vec3(0.0),diffuse.rgb,diffuse_interp.a),diffuse.rgb,const_light_mult); +# endif + +#endif + #endif @@ -1120,10 +1143,7 @@ LIGHT_SHADER_CODE #else -#ifdef USE_FOG - diffuse.rgb = mix(diffuse.rgb,fog_interp.rgb,fog_interp.a); -#endif #ifdef USE_GLOW |