DRW: Draw checkerboard alpha pattern for Cycles
Add checkerboard alpha pattern like it was in 2.79
This commit is contained in:
parent
e6705fad33
commit
47717060af
|
@ -1136,9 +1136,8 @@ static void drw_engines_draw_background(void)
|
|||
}
|
||||
|
||||
/* No draw_background found, doing default background */
|
||||
if (DRW_state_draw_background()) {
|
||||
DRW_draw_background();
|
||||
}
|
||||
const bool do_alpha_checker = !DRW_state_draw_background();
|
||||
DRW_draw_background(do_alpha_checker);
|
||||
}
|
||||
|
||||
static void drw_engines_draw_scene(void)
|
||||
|
@ -1487,6 +1486,7 @@ void DRW_draw_view(const bContext *C)
|
|||
drw_state_prepare_clean_for_draw(&DST);
|
||||
DST.options.draw_text = ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 &&
|
||||
(v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) != 0);
|
||||
DST.options.draw_background = scene->r.alphamode == R_ADDSKY;
|
||||
DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, viewport, C);
|
||||
}
|
||||
|
||||
|
@ -2730,9 +2730,6 @@ bool DRW_state_draw_support(void)
|
|||
*/
|
||||
bool DRW_state_draw_background(void)
|
||||
{
|
||||
if (DRW_state_is_image_render() == false) {
|
||||
return true;
|
||||
}
|
||||
return DST.options.draw_background;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,19 +61,35 @@ void DRW_draw_region_info(void)
|
|||
|
||||
/* ************************* Background ************************** */
|
||||
|
||||
void DRW_draw_background(void)
|
||||
void DRW_draw_background(bool do_alpha_checker)
|
||||
{
|
||||
/* 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 (do_alpha_checker) {
|
||||
/* Transparent render, do alpha checker. */
|
||||
GPU_depth_test(false);
|
||||
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_identity_set();
|
||||
GPU_matrix_identity_projection_set();
|
||||
|
||||
imm_draw_box_checker_2d(-1.0f, -1.0f, 1.0f, 1.0f);
|
||||
|
||||
GPU_matrix_pop();
|
||||
|
||||
GPU_clear(GPU_DEPTH_BIT | GPU_STENCIL_BIT);
|
||||
|
||||
GPU_depth_test(true);
|
||||
}
|
||||
else if (UI_GetThemeValue(TH_SHOW_BACK_GRAD)) {
|
||||
float m[4][4];
|
||||
unit_m4(m);
|
||||
|
||||
/* Gradient background Color */
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
GPU_depth_test(false);
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
@ -104,14 +120,15 @@ void DRW_draw_background(void)
|
|||
|
||||
GPU_matrix_pop();
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
GPU_clear(GPU_DEPTH_BIT | GPU_STENCIL_BIT);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
GPU_depth_test(true);
|
||||
}
|
||||
else {
|
||||
/* Solid background Color */
|
||||
UI_ThemeClearColorAlpha(TH_BACK, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT | GPU_STENCIL_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define __DRAW_VIEW_H__
|
||||
|
||||
void DRW_draw_region_info(void);
|
||||
void DRW_draw_background(void);
|
||||
void DRW_draw_background(bool do_alpha_checker);
|
||||
void DRW_draw_cursor(void);
|
||||
void DRW_draw_gizmo_3d(void);
|
||||
void DRW_draw_gizmo_2d(void);
|
||||
|
|
Loading…
Reference in New Issue