Fix fog in GLES2 by using epic hack, closes #25410

This commit is contained in:
Juan Linietsky 2019-02-12 14:33:57 -03:00
parent 8b77dac56e
commit 4af8009b9d
2 changed files with 12 additions and 0 deletions

View file

@ -2049,7 +2049,13 @@ FRAGMENT_SHADER_CODE
#if defined(USE_VERTEX_LIGHTING) #if defined(USE_VERTEX_LIGHTING)
#if defined(BASE_PASS)
gl_FragColor.rgb = mix(gl_FragColor.rgb, fog_interp.rgb, fog_interp.a); gl_FragColor.rgb = mix(gl_FragColor.rgb, fog_interp.rgb, fog_interp.a);
#else
gl_FragColor.rgb *= (1.0 - fog_interp.a);
#endif // BASE_PASS
#else //pixel based fog #else //pixel based fog
float fog_amount = 0.0; float fog_amount = 0.0;
@ -2083,7 +2089,11 @@ FRAGMENT_SHADER_CODE
} }
#endif #endif
#if defined(BASE_PASS)
gl_FragColor.rgb = mix(gl_FragColor.rgb, fog_color, fog_amount); gl_FragColor.rgb = mix(gl_FragColor.rgb, fog_color, fog_amount);
#else
gl_FragColor.rgb *= (1.0 - fog_amount);
#endif // BASE_PASS
#endif //use vertex lit #endif //use vertex lit

View file

@ -1704,6 +1704,8 @@ void RasterizerCanvasGLES3::canvas_debug_viewport_shadows(Light *p_lights_with_s
light = light->shadows_next_ptr; light = light->shadows_next_ptr;
} }
canvas_end();
} }
void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache) { void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, const Transform2D &p_light_xform, int p_light_mask, float p_near, float p_far, LightOccluderInstance *p_occluders, CameraMatrix *p_xform_cache) {