diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-03-15 10:22:09 +0100 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-03-15 10:22:09 +0100 |
commit | aec4f57f9507208f9aef499d8a8e8d1642bf2c72 (patch) | |
tree | fc326c281798915e9f6f38ab96d3b2ee30b69672 /drivers/gles2/rasterizer_gles2.cpp | |
parent | c1a1adae280c6a25fa776dfd083b6d7a48f580c0 (diff) | |
parent | de5281c3989fd4071cf57e5b7bc0cbbc174524e8 (diff) |
Merge pull request #3528 from SaracenOne/baked_light_realtime_colourize
Ability to colourize baked lighting in real time.
Diffstat (limited to 'drivers/gles2/rasterizer_gles2.cpp')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index e43487d719..f9b58939dc 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -6561,8 +6561,19 @@ void RasterizerGLES2::_render_list_forward(RenderList *p_render_list,const Trans material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_LIGHTMAP,false); material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_DP_SAMPLER,false); + material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_COLOR, false); + + if (material->flags[VS::MATERIAL_FLAG_UNSHADED] == false && current_debug != VS::SCENARIO_DEBUG_SHADELESS) { + if (baked_light != NULL) { + if (baked_light->realtime_color_enabled) { + float realtime_energy = baked_light->realtime_energy; + material_shader.set_conditional(MaterialShaderGLES2::ENABLE_AMBIENT_COLOR, true); + material_shader.set_uniform(MaterialShaderGLES2::AMBIENT_COLOR, Vector3(baked_light->realtime_color.r*realtime_energy, baked_light->realtime_color.g*realtime_energy, baked_light->realtime_color.b*realtime_energy)); + } + } + if (e->instance->sampled_light.is_valid()) { SampledLight *sl = sampled_light_owner.get(e->instance->sampled_light); |