diff options
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_data.c | 13 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_private.h | 1 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_view.c | 12 |
3 files changed, 23 insertions, 3 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c index 19bec9734e5..96e0e8ae18d 100644 --- a/source/blender/draw/engines/workbench/workbench_data.c +++ b/source/blender/draw/engines/workbench/workbench_data.c @@ -25,8 +25,17 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd) wpd->shadow_multiplier = 1.0 - wpd->shading.shadow_intensity; WORKBENCH_UBO_World *wd = &wpd->world_data; - UI_GetThemeColor3fv(UI_GetThemeValue(TH_SHOW_BACK_GRAD) ? TH_LOW_GRAD : TH_HIGH_GRAD, wd->background_color_low); - UI_GetThemeColor3fv(TH_HIGH_GRAD, wd->background_color_high); + + if ((v3d->flag3 & V3D_SHOW_WORLD) && + (scene->world != NULL)) + { + copy_v3_v3(wd->background_color_low, &scene->world->horr); + copy_v3_v3(wd->background_color_high, &scene->world->horr); + } + else { + UI_GetThemeColor3fv(UI_GetThemeValue(TH_SHOW_BACK_GRAD) ? TH_LOW_GRAD : TH_HIGH_GRAD, wd->background_color_low); + UI_GetThemeColor3fv(TH_HIGH_GRAD, wd->background_color_high); + } /* XXX: Really quick conversion to avoid washed out background. * Needs to be adressed properly (color managed using ocio). */ diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 54cf82c59bb..d40db7f248d 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -31,6 +31,7 @@ #include "DNA_image_types.h" #include "DNA_view3d_types.h" +#include "DNA_world_types.h" #include "DRW_render.h" diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index 726d77a9925..070a725d23d 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -28,6 +28,7 @@ #include "DNA_brush_types.h" #include "DNA_screen_types.h" #include "DNA_userdef_types.h" +#include "DNA_world_types.h" #include "DNA_view3d_types.h" #include "ED_screen.h" @@ -558,12 +559,21 @@ void DRW_draw_grid(void) void DRW_draw_background(void) { + const DRWContextState *draw_ctx = DRW_context_state_get(); + /* Just to make sure */ glDepthMask(GL_TRUE); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glStencilMask(0xFF); - if (UI_GetThemeValue(TH_SHOW_BACK_GRAD)) { + if ((draw_ctx->v3d->flag3 & V3D_SHOW_WORLD) && + (draw_ctx->scene->world != NULL)) + { + const World *world = draw_ctx->scene->world; + glClearColor(world->horr, world->horg, world->horb, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + } + else if (UI_GetThemeValue(TH_SHOW_BACK_GRAD)) { float m[4][4]; unit_m4(m); |