Edit Mode overlay: fix clear color, and possibly a crash.
This commit is contained in:
parent
747ac66800
commit
ff96f527fd
|
@ -131,7 +131,7 @@ typedef struct DRWFboTexture {
|
|||
|
||||
void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRWFboTexture textures[MAX_FBO_TEX], int texnbr);
|
||||
void DRW_framebuffer_bind(struct GPUFrameBuffer *fb);
|
||||
void DRW_framebuffer_clear(bool color, bool depth, float clear_col[4]);
|
||||
void DRW_framebuffer_clear(bool color, bool depth, float clear_col[4], float clear_depth);
|
||||
void DRW_framebuffer_texture_attach(struct GPUFrameBuffer *fb, struct GPUTexture *tex, int slot);
|
||||
void DRW_framebuffer_texture_detach(struct GPUTexture *tex);
|
||||
void DRW_framebuffer_blit(struct GPUFrameBuffer *fb_read, struct GPUFrameBuffer *fb_write, bool depth);
|
||||
|
|
|
@ -1247,14 +1247,15 @@ void DRW_framebuffer_bind(struct GPUFrameBuffer *fb)
|
|||
GPU_framebuffer_bind(fb);
|
||||
}
|
||||
|
||||
void DRW_framebuffer_clear(bool color, bool depth, float clear_col[4])
|
||||
void DRW_framebuffer_clear(bool color, bool depth, float clear_col[4], float clear_depth)
|
||||
{
|
||||
if (color) {
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
glClearColor(clear_col[0], clear_col[1], clear_col[2], clear_col[4]);
|
||||
glClearColor(clear_col[0], clear_col[1], clear_col[2], clear_col[3]);
|
||||
}
|
||||
if (depth) {
|
||||
glDepthMask(GL_TRUE);
|
||||
glClearDepth(clear_depth);
|
||||
}
|
||||
glClear(((color) ? GL_COLOR_BUFFER_BIT : 0) |
|
||||
((depth) ? GL_DEPTH_BUFFER_BIT : 0));
|
||||
|
|
|
@ -364,12 +364,17 @@ void EDIT_MESH_draw(void)
|
|||
|
||||
/* Render wires on a separate framebuffer */
|
||||
DRW_framebuffer_bind(fbl->occlude_wire_fb);
|
||||
DRW_framebuffer_clear(true, true, clearcol);
|
||||
DRW_framebuffer_clear(true, true, clearcol, 1.0f);
|
||||
DRW_draw_pass(psl->edit_face_occluded_pass);
|
||||
|
||||
/* detach textures */
|
||||
DRW_framebuffer_texture_detach(dtxl->depth);
|
||||
|
||||
/* Combine with scene buffer */
|
||||
DRW_framebuffer_bind(dfbl->default_fb);
|
||||
DRW_draw_pass(psl->mix_occlude_pass);
|
||||
|
||||
/* reattach */
|
||||
DRW_framebuffer_texture_attach(dfbl->default_fb, dtxl->depth, 0);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue