Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager.c
| Show All 32 Lines | |||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_pbvh.h" | #include "BKE_pbvh.h" | ||||
| #include "BKE_pointcache.h" | #include "BKE_pointcache.h" | ||||
| #include "BKE_pointcloud.h" | #include "BKE_pointcloud.h" | ||||
| #include "BKE_screen.h" | #include "BKE_screen.h" | ||||
| #include "BKE_subdiv_modifier.h" | #include "BKE_subdiv_modifier.h" | ||||
| #include "BKE_viewer_path.h" | |||||
| #include "BKE_volume.h" | #include "BKE_volume.h" | ||||
| #include "DNA_camera_types.h" | #include "DNA_camera_types.h" | ||||
| #include "DNA_mesh_types.h" | #include "DNA_mesh_types.h" | ||||
| #include "DNA_meshdata_types.h" | #include "DNA_meshdata_types.h" | ||||
| #include "DNA_userdef_types.h" | #include "DNA_userdef_types.h" | ||||
| #include "DNA_world_types.h" | #include "DNA_world_types.h" | ||||
| ▲ Show 20 Lines • Show All 1,641 Lines • ▼ Show 20 Lines | /* Cache filling */ | ||||
| /* Only iterate over objects for internal engines or when overlays are enabled */ | /* Only iterate over objects for internal engines or when overlays are enabled */ | ||||
| if (do_populate_loop) { | if (do_populate_loop) { | ||||
| DST.dupli_origin = NULL; | DST.dupli_origin = NULL; | ||||
| DST.dupli_origin_data = NULL; | DST.dupli_origin_data = NULL; | ||||
| DEGObjectIterSettings deg_iter_settings = {0}; | DEGObjectIterSettings deg_iter_settings = {0}; | ||||
| deg_iter_settings.depsgraph = depsgraph; | deg_iter_settings.depsgraph = depsgraph; | ||||
| deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS; | deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS; | ||||
| if (v3d->flag2 & V3D_SHOW_VIEWER) { | |||||
| deg_iter_settings.viewer_path = &v3d->viewer_path; | |||||
| } | |||||
| DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) { | DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) { | ||||
| if ((object_type_exclude_viewport & (1 << ob->type)) != 0) { | if ((object_type_exclude_viewport & (1 << ob->type)) != 0) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!BKE_object_is_visible_in_viewport(v3d, ob)) { | if (!BKE_object_is_visible_in_viewport(v3d, ob)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| DST.dupli_parent = data_.dupli_parent; | DST.dupli_parent = data_.dupli_parent; | ||||
| ▲ Show 20 Lines • Show All 786 Lines • ▼ Show 20 Lines | else { | ||||
| const int object_type_exclude_select = (v3d->object_type_exclude_viewport | | const int object_type_exclude_select = (v3d->object_type_exclude_viewport | | ||||
| v3d->object_type_exclude_select); | v3d->object_type_exclude_select); | ||||
| bool filter_exclude = false; | bool filter_exclude = false; | ||||
| DST.dupli_origin = NULL; | DST.dupli_origin = NULL; | ||||
| DST.dupli_origin_data = NULL; | DST.dupli_origin_data = NULL; | ||||
| DEGObjectIterSettings deg_iter_settings = {0}; | DEGObjectIterSettings deg_iter_settings = {0}; | ||||
| deg_iter_settings.depsgraph = depsgraph; | deg_iter_settings.depsgraph = depsgraph; | ||||
| deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS; | deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS; | ||||
| if (v3d->flag2 & V3D_SHOW_VIEWER) { | |||||
| deg_iter_settings.viewer_path = &v3d->viewer_path; | |||||
| } | |||||
| DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) { | DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) { | ||||
| if (!BKE_object_is_visible_in_viewport(v3d, ob)) { | if (!BKE_object_is_visible_in_viewport(v3d, ob)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (use_pose_exception && (ob->mode & OB_MODE_POSE)) { | if (use_pose_exception && (ob->mode & OB_MODE_POSE)) { | ||||
| if ((ob->base_flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) == 0) { | if ((ob->base_flag & BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT) == 0) { | ||||
| continue; | continue; | ||||
| ▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | DRW_smoke_init(DST.vmempool); | ||||
| drw_engines_world_update(DST.draw_ctx.scene); | drw_engines_world_update(DST.draw_ctx.scene); | ||||
| const int object_type_exclude_viewport = v3d->object_type_exclude_viewport; | const int object_type_exclude_viewport = v3d->object_type_exclude_viewport; | ||||
| DST.dupli_origin = NULL; | DST.dupli_origin = NULL; | ||||
| DST.dupli_origin_data = NULL; | DST.dupli_origin_data = NULL; | ||||
| DEGObjectIterSettings deg_iter_settings = {0}; | DEGObjectIterSettings deg_iter_settings = {0}; | ||||
| deg_iter_settings.depsgraph = DST.draw_ctx.depsgraph; | deg_iter_settings.depsgraph = DST.draw_ctx.depsgraph; | ||||
| deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS; | deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS; | ||||
| if (v3d->flag2 & V3D_SHOW_VIEWER) { | |||||
| deg_iter_settings.viewer_path = &v3d->viewer_path; | |||||
| } | |||||
| DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) { | DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob) { | ||||
| if ((object_type_exclude_viewport & (1 << ob->type)) != 0) { | if ((object_type_exclude_viewport & (1 << ob->type)) != 0) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!BKE_object_is_visible_in_viewport(v3d, ob)) { | if (!BKE_object_is_visible_in_viewport(v3d, ob)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| DST.dupli_parent = data_.dupli_parent; | DST.dupli_parent = data_.dupli_parent; | ||||
| ▲ Show 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| void DRW_render_context_enable(Render *render) | void DRW_render_context_enable(Render *render) | ||||
| { | { | ||||
| if (G.background && DST.gl_context == NULL) { | if (G.background && DST.gl_context == NULL) { | ||||
| WM_init_opengl(); | WM_init_opengl(); | ||||
| } | } | ||||
| GPU_render_begin(); | |||||
| if (GPU_use_main_context_workaround()) { | if (GPU_use_main_context_workaround()) { | ||||
| GPU_context_main_lock(); | GPU_context_main_lock(); | ||||
| DRW_opengl_context_enable(); | DRW_opengl_context_enable(); | ||||
| return; | return; | ||||
| } | } | ||||
| void *re_gl_context = RE_gl_context_get(render); | void *re_gl_context = RE_gl_context_get(render); | ||||
| /* Changing Context */ | /* Changing Context */ | ||||
| if (re_gl_context != NULL) { | if (re_gl_context != NULL) { | ||||
| DRW_opengl_render_context_enable(re_gl_context); | DRW_opengl_render_context_enable(re_gl_context); | ||||
| /* We need to query gpu context after a gl context has been bound. */ | /* We need to query gpu context after a gl context has been bound. */ | ||||
| void *re_gpu_context = NULL; | void *re_gpu_context = NULL; | ||||
| re_gpu_context = RE_gpu_context_get(render); | re_gpu_context = RE_gpu_context_get(render); | ||||
| DRW_gpu_render_context_enable(re_gpu_context); | DRW_gpu_render_context_enable(re_gpu_context); | ||||
| } | } | ||||
| else { | else { | ||||
| DRW_opengl_context_enable(); | DRW_opengl_context_enable(); | ||||
| } | } | ||||
| } | } | ||||
| void DRW_render_context_disable(Render *render) | void DRW_render_context_disable(Render *render) | ||||
| { | { | ||||
| GPU_render_end(); | |||||
| if (GPU_use_main_context_workaround()) { | if (GPU_use_main_context_workaround()) { | ||||
| DRW_opengl_context_disable(); | DRW_opengl_context_disable(); | ||||
| GPU_context_main_unlock(); | GPU_context_main_unlock(); | ||||
| return; | return; | ||||
| } | } | ||||
| void *re_gl_context = RE_gl_context_get(render); | void *re_gl_context = RE_gl_context_get(render); | ||||
| ▲ Show 20 Lines • Show All 246 Lines • Show Last 20 Lines | |||||