Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager.c
| Show First 20 Lines • Show All 578 Lines • ▼ Show 20 Lines | static void drw_context_state_init(void) | ||||
| else if (DST.draw_ctx.object_mode & OB_MODE_WEIGHT_PAINT) { | else if (DST.draw_ctx.object_mode & OB_MODE_WEIGHT_PAINT) { | ||||
| DST.draw_ctx.object_pose = BKE_object_pose_armature_get(DST.draw_ctx.obact); | DST.draw_ctx.object_pose = BKE_object_pose_armature_get(DST.draw_ctx.obact); | ||||
| } | } | ||||
| else { | else { | ||||
| DST.draw_ctx.object_pose = NULL; | DST.draw_ctx.object_pose = NULL; | ||||
| } | } | ||||
| DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_DEFAULT; | DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_DEFAULT; | ||||
| if (DST.draw_ctx.rv3d && DST.draw_ctx.rv3d->rflag & RV3D_CLIPPING) { | if (DRW_state_is_clipping_enabled()) { | ||||
| DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_CLIPPED; | DST.draw_ctx.sh_cfg = GPU_SHADER_CFG_CLIPPED; | ||||
| } | } | ||||
| } | } | ||||
| static void draw_unit_state_create(void) | static void draw_unit_state_create(void) | ||||
| { | { | ||||
| DRWObjectInfos *infos = BLI_memblock_alloc(DST.vmempool->obinfos); | DRWObjectInfos *infos = BLI_memblock_alloc(DST.vmempool->obinfos); | ||||
| DRWObjectMatrix *mats = BLI_memblock_alloc(DST.vmempool->obmats); | DRWObjectMatrix *mats = BLI_memblock_alloc(DST.vmempool->obmats); | ||||
| ▲ Show 20 Lines • Show All 2,096 Lines • ▼ Show 20 Lines | void DRW_draw_depth_object(ARegion *ar, GPUViewport *viewport, Object *object) | ||||
| 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); | ||||
| GPU_framebuffer_clear_depth(fbl->depth_only_fb, 1.0f); | GPU_framebuffer_clear_depth(fbl->depth_only_fb, 1.0f); | ||||
| GPU_depth_test(true); | GPU_depth_test(true); | ||||
| GPU_matrix_mul(object->obmat); | GPU_matrix_mul(object->obmat); | ||||
| const float(*world_clip_planes)[4] = NULL; | const float(*world_clip_planes)[4] = NULL; | ||||
| if (rv3d->rflag & RV3D_CLIPPING) { | if (DRW_state_is_clipping_enabled()) { | ||||
| ED_view3d_clipping_set(rv3d); | ED_view3d_clipping_set(rv3d); | ||||
| ED_view3d_clipping_local(rv3d, object->obmat); | ED_view3d_clipping_local(rv3d, object->obmat); | ||||
| world_clip_planes = rv3d->clip_local; | world_clip_planes = rv3d->clip_local; | ||||
| } | } | ||||
| drw_batch_cache_validate(object); | drw_batch_cache_validate(object); | ||||
| switch (object->type) { | switch (object->type) { | ||||
| Show All 20 Lines | case OB_MESH: { | ||||
| GPU_batch_draw(batch); | GPU_batch_draw(batch); | ||||
| } break; | } break; | ||||
| case OB_CURVE: | case OB_CURVE: | ||||
| case OB_SURF: | case OB_SURF: | ||||
| break; | break; | ||||
| } | } | ||||
| if (rv3d->rflag & RV3D_CLIPPING) { | if (DRW_state_is_clipping_enabled()) { | ||||
| ED_view3d_clipping_disable(); | ED_view3d_clipping_disable(); | ||||
| } | } | ||||
| GPU_matrix_set(rv3d->viewmat); | GPU_matrix_set(rv3d->viewmat); | ||||
| GPU_depth_test(false); | GPU_depth_test(false); | ||||
| GPU_framebuffer_restore(); | GPU_framebuffer_restore(); | ||||
| DRW_opengl_context_disable(); | DRW_opengl_context_disable(); | ||||
| } | } | ||||
| Show All 15 Lines | |||||
| */ | */ | ||||
| bool DRW_state_is_fbo(void) | bool DRW_state_is_fbo(void) | ||||
| { | { | ||||
| return ((DST.default_framebuffer != NULL) || DST.options.is_image_render) && | return ((DST.default_framebuffer != NULL) || DST.options.is_image_render) && | ||||
| !DRW_state_is_depth() && !DRW_state_is_select(); | !DRW_state_is_depth() && !DRW_state_is_select(); | ||||
| } | } | ||||
| /** | /** | ||||
| * Is viewport clipping enabled. | |||||
| */ | |||||
| bool DRW_state_is_clipping_enabled(void) { | |||||
| return DST.draw_ctx.rv3d && (DST.draw_ctx.rv3d->rflag & RV3D_CLIPPING) && ELEM(DST.draw_ctx.v3d->shading.type, OB_WIRE, OB_SOLID); | |||||
| } | |||||
| /** | |||||
| * For when engines need to know if this is drawing for selection or not. | * For when engines need to know if this is drawing for selection or not. | ||||
| */ | */ | ||||
| bool DRW_state_is_select(void) | bool DRW_state_is_select(void) | ||||
| { | { | ||||
| return DST.options.is_select; | return DST.options.is_select; | ||||
| } | } | ||||
| bool DRW_state_is_depth(void) | bool DRW_state_is_depth(void) | ||||
| ▲ Show 20 Lines • Show All 324 Lines • Show Last 20 Lines | |||||