From 37fc23dd9e7738de7187e889f058cda845544ffb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 24 Nov 2017 11:43:16 +0100 Subject: Refactor view3d offscreen drawing to avoid having multiple boolean arguments This is fully unreadable to have lots of boolean arguments scattered across the whole argument list. What does `false, true, true` mean in terms of behavior? Replace those with bitfield which has advantage of having more human readable meaning. --- source/blender/editors/include/ED_view3d.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/include') diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 85fb0ee4447..0a87360e58d 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -367,15 +367,26 @@ void ED_view3d_draw_setup_view( struct wmWindow *win, struct Scene *scene, struct ARegion *ar, struct View3D *v3d, float viewmat[4][4], float winmat[4][4], const struct rcti *rect); +enum { + V3D_OFSDRAW_NONE = (0), + + V3D_OFSDRAW_USE_BACKGROUND = (1 << 0), + V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 1), + + /* Only works with ED_view3d_draw_offscreen_imbuf_simple(). */ + V3D_OFSDRAW_USE_GPENCIL = (1 << 2), + V3D_OFSDRAW_USE_SOLID_TEX = (1 << 2), +}; + struct ImBuf *ED_view3d_draw_offscreen_imbuf( struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, - unsigned int flag, bool draw_background, - int alpha_mode, int samples, bool full_samples, const char *viewname, + unsigned int flag, unsigned int draw_flags, + int alpha_mode, int samples, const char *viewname, struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple( struct Scene *scene, struct Object *camera, int width, int height, - unsigned int flag, int drawtype, bool use_solid_tex, bool use_gpencil, bool draw_background, - int alpha_mode, int samples, bool full_samples, const char *viewname, + unsigned int flag, unsigned int draw_flags, int drawtype, int alpha_mode, + int samples, const char *viewname, struct GPUFX *fx, struct GPUOffScreen *ofs, char err_out[256]); struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]); -- cgit v1.2.3