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 (RV3D_CLIPPING_ENABLED(DST.draw_ctx.v3d, DST.draw_ctx.rv3d)) { | ||||
| 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 634 Lines • ▼ Show 20 Lines | |||||
| static void drw_engines_draw_text(void) | static void drw_engines_draw_text(void) | ||||
| { | { | ||||
| for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { | for (LinkData *link = DST.enabled_engines.first; link; link = link->next) { | ||||
| DrawEngineType *engine = link->data; | DrawEngineType *engine = link->data; | ||||
| ViewportEngineData *data = drw_viewport_engine_data_ensure(engine); | ViewportEngineData *data = drw_viewport_engine_data_ensure(engine); | ||||
| PROFILE_START(stime); | PROFILE_START(stime); | ||||
| if (data->text_draw_cache) { | if (data->text_draw_cache) { | ||||
| DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar); | DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar, DST.draw_ctx.v3d); | ||||
| } | } | ||||
| PROFILE_END_UPDATE(data->render_time, stime); | PROFILE_END_UPDATE(data->render_time, stime); | ||||
| } | } | ||||
| } | } | ||||
| /* Draw render engine info. */ | /* Draw render engine info. */ | ||||
| void DRW_draw_region_engine_info(int xoffset, int yoffset) | void DRW_draw_region_engine_info(int xoffset, int yoffset) | ||||
| ▲ Show 20 Lines • Show All 1,319 Lines • ▼ Show 20 Lines | |||||
| static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_clip_planes[6][4]) | static void draw_world_clip_planes_from_rv3d(GPUBatch *batch, const float world_clip_planes[6][4]) | ||||
| { | { | ||||
| GPU_batch_uniform_4fv_array(batch, "WorldClipPlanes", 6, world_clip_planes[0]); | GPU_batch_uniform_4fv_array(batch, "WorldClipPlanes", 6, world_clip_planes[0]); | ||||
| } | } | ||||
| /** | /** | ||||
| * 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(ARegion *ar, GPUViewport *viewport, Object *object) | void DRW_draw_depth_object(ARegion *ar, View3D *v3d, GPUViewport *viewport, Object *object) | ||||
| { | { | ||||
| RegionView3D *rv3d = ar->regiondata; | RegionView3D *rv3d = ar->regiondata; | ||||
| DRW_opengl_context_enable(); | 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 framebuffer */ | /* Setup framebuffer */ | ||||
| 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); | ||||
| const float(*world_clip_planes)[4] = NULL; | const float(*world_clip_planes)[4] = NULL; | ||||
| if (rv3d->rflag & RV3D_CLIPPING) { | if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | ||||
| 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 (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | ||||
| 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 20 Lines • Show All 343 Lines • Show Last 20 Lines | |||||