diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-12-17 19:01:06 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-12-17 19:11:45 +0300 |
commit | 4cd558b7115e40affe2e94769bfa16b2a29fd176 (patch) | |
tree | 03d83cea2a5a3369bef99722d20a3a96beae37c7 /source/blender/draw/modes/paint_texture_mode.c | |
parent | 7ac49a07c60111fe75805a5eb72824ab7d0bc777 (diff) |
Mesh Batch Cache: Port Texture paint wires to new batch request
Diffstat (limited to 'source/blender/draw/modes/paint_texture_mode.c')
-rw-r--r-- | source/blender/draw/modes/paint_texture_mode.c | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c index 8e78d2f03b4..8fb854efd0d 100644 --- a/source/blender/draw/modes/paint_texture_mode.c +++ b/source/blender/draw/modes/paint_texture_mode.c @@ -45,6 +45,9 @@ extern char datatoc_paint_texture_vert_glsl[]; extern char datatoc_paint_texture_frag_glsl[]; extern char datatoc_paint_wire_vert_glsl[]; extern char datatoc_paint_wire_frag_glsl[]; +extern char datatoc_paint_face_vert_glsl[]; + +extern char datatoc_gpu_shader_uniform_color_frag_glsl[]; /* If needed, contains all global/Theme colors * Add needed theme colors / values to DRW_globals_update() and update UBO @@ -130,35 +133,12 @@ typedef struct PAINT_TEXTURE_PrivateData { /* *********** FUNCTIONS *********** */ /* Init Textures, Framebuffers, Storage and Shaders. - * It is called for every frames. - * (Optional) */ -static void PAINT_TEXTURE_engine_init(void *vedata) + * It is called for every frames. */ +static void PAINT_TEXTURE_engine_init(void *UNUSED(vedata)) { - PAINT_TEXTURE_TextureList *txl = ((PAINT_TEXTURE_Data *)vedata)->txl; - PAINT_TEXTURE_FramebufferList *fbl = ((PAINT_TEXTURE_Data *)vedata)->fbl; - PAINT_TEXTURE_StorageList *stl = ((PAINT_TEXTURE_Data *)vedata)->stl; - - UNUSED_VARS(txl, fbl, stl); - - /* Init Framebuffers like this: order is attachment order (for color texs) */ - /* - * DRWFboTexture tex[2] = {{&txl->depth, GPU_DEPTH_COMPONENT24, 0}, - * {&txl->color, GPU_RGBA8, DRW_TEX_FILTER}}; - */ - - /* DRW_framebuffer_init takes care of checking if - * the framebuffer is valid and has the right size*/ - /* - * float *viewport_size = DRW_viewport_size_get(); - * DRW_framebuffer_init(&fbl->occlude_wire_fb, - * (int)viewport_size[0], (int)viewport_size[1], - * tex, 2); - */ - if (!e_data.fallback_sh) { e_data.fallback_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR); - } - if (!e_data.image_sh) { + e_data.image_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR); e_data.image_sh = DRW_shader_create_with_lib( @@ -166,18 +146,15 @@ static void PAINT_TEXTURE_engine_init(void *vedata) datatoc_paint_texture_frag_glsl, datatoc_common_globals_lib_glsl, NULL); - } - - if (!e_data.wire_overlay_shader) { e_data.wire_overlay_shader = DRW_shader_create_with_lib( datatoc_paint_wire_vert_glsl, NULL, datatoc_paint_wire_frag_glsl, datatoc_common_globals_lib_glsl, "#define VERTEX_MODE\n"); - } - if (!e_data.face_overlay_shader) { - e_data.face_overlay_shader = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR); + e_data.face_overlay_shader = DRW_shader_create( + datatoc_paint_face_vert_glsl, NULL, + datatoc_gpu_shader_uniform_color_frag_glsl, NULL); } } @@ -328,12 +305,10 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob) /* Face Mask */ if (use_face_sel) { struct GPUBatch *geom; - /* Note: ideally selected faces wouldn't show interior wire. */ - const bool use_wire = true; - geom = DRW_cache_mesh_edges_paint_overlay_get(ob, use_wire, use_face_sel); + geom = DRW_cache_mesh_wire_get(ob); DRW_shgroup_call_add(stl->g_data->lwire_shgrp, geom, ob->obmat); - geom = DRW_cache_mesh_faces_weight_overlay_get(ob); + geom = DRW_cache_mesh_surface_get(ob); DRW_shgroup_call_add(stl->g_data->face_shgrp, geom, ob->obmat); } } |