Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager.c
| Show First 20 Lines • Show All 2,595 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** | /** | ||||
| * object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing). | * object mode select-loop, see: ED_view3d_draw_depth_loop (legacy drawing). | ||||
| */ | */ | ||||
| void DRW_draw_depth_loop(struct Depsgraph *depsgraph, | void DRW_draw_depth_loop(struct Depsgraph *depsgraph, | ||||
| ARegion *region, | ARegion *region, | ||||
| View3D *v3d, | View3D *v3d, | ||||
| GPUViewport *viewport, | GPUViewport *viewport) | ||||
| bool use_opengl_context) | |||||
| { | { | ||||
| /* Reset before using it. */ | /* Reset before using it. */ | ||||
| drw_state_prepare_clean_for_draw(&DST); | drw_state_prepare_clean_for_draw(&DST); | ||||
| /* Get list of enabled engines */ | /* Get list of enabled engines */ | ||||
| { | { | ||||
| /* Required by `DRW_state_draw_support()` */ | /* Required by `DRW_state_draw_support()` */ | ||||
| DST.draw_ctx.v3d = v3d; | DST.draw_ctx.v3d = v3d; | ||||
| drw_engines_enable_basic(); | drw_engines_enable_basic(); | ||||
| if (DRW_state_draw_support()) { | if (DRW_state_draw_support()) { | ||||
| drw_engines_enable_overlays(); | drw_engines_enable_overlays(); | ||||
| } | } | ||||
| } | } | ||||
| drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, use_opengl_context); | drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, false); | ||||
| } | } | ||||
| /** | /** | ||||
| * Converted from ED_view3d_draw_depth_gpencil (legacy drawing). | * Converted from ED_view3d_draw_depth_gpencil (legacy drawing). | ||||
| */ | */ | ||||
| void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, | void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph, | ||||
| ARegion *region, | ARegion *region, | ||||
| View3D *v3d, | View3D *v3d, | ||||
| GPUViewport *viewport) | GPUViewport *viewport) | ||||
| { | { | ||||
| /* Reset before using it. */ | /* Reset before using it. */ | ||||
| drw_state_prepare_clean_for_draw(&DST); | drw_state_prepare_clean_for_draw(&DST); | ||||
| use_drw_engine(&draw_engine_gpencil_type); | use_drw_engine(&draw_engine_gpencil_type); | ||||
| drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, true); | drw_draw_depth_loop_impl(depsgraph, region, v3d, viewport, false); | ||||
| } | } | ||||
| void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect) | void DRW_draw_select_id(Depsgraph *depsgraph, ARegion *region, View3D *v3d, const rcti *rect) | ||||
| { | { | ||||
| SELECTID_Context *sel_ctx = DRW_select_engine_context_get(); | SELECTID_Context *sel_ctx = DRW_select_engine_context_get(); | ||||
| GPUViewport *viewport = WM_draw_region_get_viewport(region); | GPUViewport *viewport = WM_draw_region_get_viewport(region); | ||||
| if (!viewport) { | if (!viewport) { | ||||
| /* Selection engine requires a viewport. | /* Selection engine requires a viewport. | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * Clears the Depth Buffer and draws only the specified object. | * Clears the Depth Buffer and draws only the specified object. | ||||
| */ | */ | ||||
| void DRW_draw_depth_object( | void DRW_draw_depth_object( | ||||
| Scene *scene, ARegion *region, View3D *v3d, GPUViewport *viewport, Object *object) | Scene *scene, ARegion *region, View3D *v3d, GPUViewport *viewport, Object *object) | ||||
| { | { | ||||
| RegionView3D *rv3d = region->regiondata; | RegionView3D *rv3d = region->regiondata; | ||||
| DRW_opengl_context_enable(); | |||||
| GPU_matrix_projection_set(rv3d->winmat); | GPU_matrix_projection_set(rv3d->winmat); | ||||
| GPU_matrix_set(rv3d->viewmat); | GPU_matrix_set(rv3d->viewmat); | ||||
| GPU_matrix_mul(object->obmat); | GPU_matrix_mul(object->obmat); | ||||
| /* Setup frame-buffer. */ | /* Setup frame-buffer. */ | ||||
| DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); | DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); | ||||
| GPU_framebuffer_bind(fbl->depth_only_fb); | GPU_framebuffer_bind(fbl->depth_only_fb); | ||||
| ▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | void DRW_draw_depth_object( | ||||
| if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | ||||
| GPU_clip_distances(0); | GPU_clip_distances(0); | ||||
| } | } | ||||
| GPU_matrix_set(rv3d->viewmat); | GPU_matrix_set(rv3d->viewmat); | ||||
| GPU_depth_test(GPU_DEPTH_NONE); | GPU_depth_test(GPU_DEPTH_NONE); | ||||
| GPU_framebuffer_restore(); | GPU_framebuffer_restore(); | ||||
| DRW_opengl_context_disable(); | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Draw Manager State (DRW_state) | /** \name Draw Manager State (DRW_state) | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 427 Lines • Show Last 20 Lines | |||||