Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_engine.c
| Show First 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | switch (pd->ctx_mode) { | ||||
| default: | default: | ||||
| BLI_assert(!"Draw mode invalid"); | BLI_assert(!"Draw mode invalid"); | ||||
| break; | break; | ||||
| } | } | ||||
| OVERLAY_antialiasing_cache_init(vedata); | OVERLAY_antialiasing_cache_init(vedata); | ||||
| OVERLAY_armature_cache_init(vedata); | OVERLAY_armature_cache_init(vedata); | ||||
| OVERLAY_background_cache_init(vedata); | OVERLAY_background_cache_init(vedata); | ||||
| OVERLAY_fade_cache_init(vedata); | OVERLAY_fade_cache_init(vedata); | ||||
| OVERLAY_flash_cache_init(vedata); | |||||
| OVERLAY_extra_cache_init(vedata); | OVERLAY_extra_cache_init(vedata); | ||||
| OVERLAY_facing_cache_init(vedata); | OVERLAY_facing_cache_init(vedata); | ||||
| OVERLAY_gpencil_cache_init(vedata); | OVERLAY_gpencil_cache_init(vedata); | ||||
| OVERLAY_grid_cache_init(vedata); | OVERLAY_grid_cache_init(vedata); | ||||
| OVERLAY_image_cache_init(vedata); | OVERLAY_image_cache_init(vedata); | ||||
| OVERLAY_metaball_cache_init(vedata); | OVERLAY_metaball_cache_init(vedata); | ||||
| OVERLAY_motion_path_cache_init(vedata); | OVERLAY_motion_path_cache_init(vedata); | ||||
| OVERLAY_outline_cache_init(vedata); | OVERLAY_outline_cache_init(vedata); | ||||
| ▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | const bool has_surface = ELEM(ob->type, | ||||
| OB_HAIR, | OB_HAIR, | ||||
| OB_POINTCLOUD, | OB_POINTCLOUD, | ||||
| OB_VOLUME); | OB_VOLUME); | ||||
| const bool draw_surface = (ob->dt >= OB_WIRE) && (renderable || (ob->dt == OB_WIRE)); | const bool draw_surface = (ob->dt >= OB_WIRE) && (renderable || (ob->dt == OB_WIRE)); | ||||
| const bool draw_facing = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) && | const bool draw_facing = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) && | ||||
| !is_select; | !is_select; | ||||
| const bool draw_fade = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FADE_INACTIVE) && | const bool draw_fade = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FADE_INACTIVE) && | ||||
| overlay_should_fade_object(ob, draw_ctx->obact); | overlay_should_fade_object(ob, draw_ctx->obact); | ||||
| const bool draw_flash = draw_surface && (pd->overlay.flag & V3D_OVERLAY_FLASH_MODE_TRANSFER); | |||||
| const bool draw_bones = (pd->overlay.flag & V3D_OVERLAY_HIDE_BONES) == 0; | const bool draw_bones = (pd->overlay.flag & V3D_OVERLAY_HIDE_BONES) == 0; | ||||
| const bool draw_wires = draw_surface && has_surface && | const bool draw_wires = draw_surface && has_surface && | ||||
| (pd->wireframe_mode || !pd->hide_overlays); | (pd->wireframe_mode || !pd->hide_overlays); | ||||
| const bool draw_outlines = !in_edit_mode && !in_paint_mode && renderable && has_surface && | const bool draw_outlines = !in_edit_mode && !in_paint_mode && renderable && has_surface && | ||||
| (pd->v3d_flag & V3D_SELECT_OUTLINE) && | (pd->v3d_flag & V3D_SELECT_OUTLINE) && | ||||
| (ob->base_flag & BASE_SELECTED); | (ob->base_flag & BASE_SELECTED); | ||||
| const bool draw_bone_selection = (ob->type == OB_MESH) && pd->armature.do_pose_fade_geom && | const bool draw_bone_selection = (ob->type == OB_MESH) && pd->armature.do_pose_fade_geom && | ||||
| !is_select; | !is_select; | ||||
| Show All 10 Lines | static void OVERLAY_cache_populate(void *vedata, Object *ob) | ||||
| OVERLAY_DupliData *dupli = OVERLAY_duplidata_get(ob, vedata, &do_init); | OVERLAY_DupliData *dupli = OVERLAY_duplidata_get(ob, vedata, &do_init); | ||||
| if (draw_fade) { | if (draw_fade) { | ||||
| OVERLAY_fade_cache_populate(vedata, ob); | OVERLAY_fade_cache_populate(vedata, ob); | ||||
| } | } | ||||
| if (draw_facing) { | if (draw_facing) { | ||||
| OVERLAY_facing_cache_populate(vedata, ob); | OVERLAY_facing_cache_populate(vedata, ob); | ||||
| } | } | ||||
| if (draw_flash) { | |||||
| OVERLAY_flash_cache_populate(vedata, ob); | |||||
| } | |||||
| if (draw_wires) { | if (draw_wires) { | ||||
| OVERLAY_wireframe_cache_populate(vedata, ob, dupli, do_init); | OVERLAY_wireframe_cache_populate(vedata, ob, dupli, do_init); | ||||
| } | } | ||||
| if (draw_outlines) { | if (draw_outlines) { | ||||
| OVERLAY_outline_cache_populate(vedata, ob, dupli, do_init); | OVERLAY_outline_cache_populate(vedata, ob, dupli, do_init); | ||||
| } | } | ||||
| if (draw_bone_selection) { | if (draw_bone_selection) { | ||||
| OVERLAY_pose_cache_populate(vedata, ob); | OVERLAY_pose_cache_populate(vedata, ob); | ||||
| ▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | /* TODO(fclem): Only do this when really needed. */ | ||||
| DRW_texture_ensure_fullscreen_2d(&dtxl->depth_in_front, GPU_DEPTH24_STENCIL8, 0); | DRW_texture_ensure_fullscreen_2d(&dtxl->depth_in_front, GPU_DEPTH24_STENCIL8, 0); | ||||
| GPU_framebuffer_ensure_config( | GPU_framebuffer_ensure_config( | ||||
| &dfbl->in_front_fb, | &dfbl->in_front_fb, | ||||
| {GPU_ATTACHMENT_TEXTURE(dtxl->depth_in_front), GPU_ATTACHMENT_TEXTURE(dtxl->color)}); | {GPU_ATTACHMENT_TEXTURE(dtxl->depth_in_front), GPU_ATTACHMENT_TEXTURE(dtxl->color)}); | ||||
| } | } | ||||
| OVERLAY_flash_cache_finish(vedata); | |||||
| OVERLAY_antialiasing_cache_finish(vedata); | OVERLAY_antialiasing_cache_finish(vedata); | ||||
| OVERLAY_armature_cache_finish(vedata); | OVERLAY_armature_cache_finish(vedata); | ||||
| OVERLAY_image_cache_finish(vedata); | OVERLAY_image_cache_finish(vedata); | ||||
| } | } | ||||
| static void OVERLAY_draw_scene(void *vedata) | static void OVERLAY_draw_scene(void *vedata) | ||||
| { | { | ||||
| OVERLAY_Data *data = vedata; | OVERLAY_Data *data = vedata; | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | static void OVERLAY_draw_scene(void *vedata) | ||||
| if (DRW_state_is_fbo()) { | if (DRW_state_is_fbo()) { | ||||
| GPU_framebuffer_bind(fbl->overlay_default_fb); | GPU_framebuffer_bind(fbl->overlay_default_fb); | ||||
| } | } | ||||
| OVERLAY_image_draw(vedata); | OVERLAY_image_draw(vedata); | ||||
| OVERLAY_fade_draw(vedata); | OVERLAY_fade_draw(vedata); | ||||
| OVERLAY_facing_draw(vedata); | OVERLAY_facing_draw(vedata); | ||||
| OVERLAY_flash_draw(vedata); | |||||
| OVERLAY_extra_blend_draw(vedata); | OVERLAY_extra_blend_draw(vedata); | ||||
| OVERLAY_volume_draw(vedata); | OVERLAY_volume_draw(vedata); | ||||
| if (pd->ctx_mode == CTX_MODE_SCULPT) { | if (pd->ctx_mode == CTX_MODE_SCULPT) { | ||||
| /* Sculpt overlays are drawn here to avoid artifacts with wireframe opacity. */ | /* Sculpt overlays are drawn here to avoid artifacts with wireframe opacity. */ | ||||
| OVERLAY_sculpt_draw(vedata); | OVERLAY_sculpt_draw(vedata); | ||||
| } | } | ||||
| Show All 23 Lines | static void OVERLAY_draw_scene(void *vedata) | ||||
| } | } | ||||
| if (DRW_state_is_fbo()) { | if (DRW_state_is_fbo()) { | ||||
| GPU_framebuffer_bind(fbl->overlay_in_front_fb); | GPU_framebuffer_bind(fbl->overlay_in_front_fb); | ||||
| } | } | ||||
| OVERLAY_fade_infront_draw(vedata); | OVERLAY_fade_infront_draw(vedata); | ||||
| OVERLAY_facing_infront_draw(vedata); | OVERLAY_facing_infront_draw(vedata); | ||||
| OVERLAY_flash_infront_draw(vedata); | |||||
| if (DRW_state_is_fbo()) { | if (DRW_state_is_fbo()) { | ||||
| GPU_framebuffer_bind(fbl->overlay_line_in_front_fb); | GPU_framebuffer_bind(fbl->overlay_line_in_front_fb); | ||||
| } | } | ||||
| OVERLAY_wireframe_in_front_draw(vedata); | OVERLAY_wireframe_in_front_draw(vedata); | ||||
| OVERLAY_armature_in_front_draw(vedata); | OVERLAY_armature_in_front_draw(vedata); | ||||
| OVERLAY_extra_in_front_draw(vedata); | OVERLAY_extra_in_front_draw(vedata); | ||||
| ▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines | |||||