summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles2/rasterizer_gles2.cpp18
-rw-r--r--drivers/gles2/shaders/material.glsl10
-rw-r--r--drivers/unix/os_unix.cpp4
3 files changed, 31 insertions, 1 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp
index e43487d719..1568d93af7 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);
@@ -10769,9 +10780,16 @@ bool RasterizerGLES2::_test_depth_shadow_buffer() {
void RasterizerGLES2::init() {
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ print_line("Using GLES2 video driver");
+ }
+
#ifdef GLEW_ENABLED
GLuint res = glewInit();
ERR_FAIL_COND(res!=GLEW_OK);
+ if (OS::get_singleton()->is_stdout_verbose()) {
+ print_line(String("GLES2: Using GLEW ") + (const char*) glewGetString(GLEW_VERSION));
+ }
#endif
diff --git a/drivers/gles2/shaders/material.glsl b/drivers/gles2/shaders/material.glsl
index ccd80bf2f0..e68949b056 100644
--- a/drivers/gles2/shaders/material.glsl
+++ b/drivers/gles2/shaders/material.glsl
@@ -618,6 +618,12 @@ uniform float ambient_dp_sampler_multiplier;
#endif
+#ifdef ENABLE_AMBIENT_COLOR
+
+uniform vec3 ambient_color;
+
+#endif
+
FRAGMENT_SHADER_GLOBALS
@@ -1262,7 +1268,9 @@ LIGHT_SHADER_CODE
#if defined(ENABLE_AMBIENT_OCTREE) || defined(ENABLE_AMBIENT_LIGHTMAP) || defined(ENABLE_AMBIENT_DP_SAMPLER)
-
+#if defined(ENABLE_AMBIENT_COLOR)
+ ambientmap_color*=ambient_color;
+#endif
diffuse.rgb+=ambientmap_color;
#endif
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index a004a116e0..359758290f 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -251,6 +251,9 @@ OS::Date OS_Unix::get_date(bool utc) const {
lt=localtime(&t);
Date ret;
ret.year=1900+lt->tm_year;
+ // Index starting at 1 to match OS_Unix::get_date
+ // and Windows SYSTEMTIME and tm_mon follows the typical structure
+ // of 0-11, noted here: http://www.cplusplus.com/reference/ctime/tm/
ret.month=(Month)(lt->tm_mon + 1);
ret.day=lt->tm_mday;
ret.weekday=(Weekday)lt->tm_wday;
@@ -258,6 +261,7 @@ OS::Date OS_Unix::get_date(bool utc) const {
return ret;
}
+
OS::Time OS_Unix::get_time(bool utc) const {
time_t t=time(NULL);
struct tm *lt;