Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/workbench/workbench_data.c
| Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| const Scene *scene = draw_ctx->scene; | const Scene *scene = draw_ctx->scene; | ||||
| wpd->material_hash = BLI_ghash_ptr_new(__func__); | wpd->material_hash = BLI_ghash_ptr_new(__func__); | ||||
| wpd->material_transp_hash = BLI_ghash_ptr_new(__func__); | wpd->material_transp_hash = BLI_ghash_ptr_new(__func__); | ||||
| wpd->preferences = &U; | wpd->preferences = &U; | ||||
| View3D *v3d = draw_ctx->v3d; | View3D *v3d = draw_ctx->v3d; | ||||
| RegionView3D *rv3d = draw_ctx->rv3d; | |||||
| if (!v3d || (v3d->shading.type == OB_RENDER && BKE_scene_uses_blender_workbench(scene))) { | if (!v3d || (v3d->shading.type == OB_RENDER && BKE_scene_uses_blender_workbench(scene))) { | ||||
| wpd->shading = scene->display.shading; | wpd->shading = scene->display.shading; | ||||
| wpd->shading.xray_alpha = XRAY_ALPHA((&scene->display)); | wpd->shading.xray_alpha = XRAY_ALPHA((&scene->display)); | ||||
| wpd->use_color_render_settings = true; | wpd->use_color_render_settings = true; | ||||
| } | } | ||||
| else { | else { | ||||
| wpd->shading = v3d->shading; | wpd->shading = v3d->shading; | ||||
| wpd->shading.xray_alpha = XRAY_ALPHA(v3d); | wpd->shading.xray_alpha = XRAY_ALPHA(v3d); | ||||
| ▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | void workbench_private_data_init(WORKBENCH_PrivateData *wpd) | ||||
| copy_v3_v3(wd->object_outline_color, wpd->shading.object_outline_color); | copy_v3_v3(wd->object_outline_color, wpd->shading.object_outline_color); | ||||
| wd->object_outline_color[3] = 1.0f; | wd->object_outline_color[3] = 1.0f; | ||||
| wd->curvature_ridge = 0.5f / max_ff(SQUARE(wpd->shading.curvature_ridge_factor), 1e-4f); | wd->curvature_ridge = 0.5f / max_ff(SQUARE(wpd->shading.curvature_ridge_factor), 1e-4f); | ||||
| wd->curvature_valley = 0.7f / max_ff(SQUARE(wpd->shading.curvature_valley_factor), 1e-4f); | wd->curvature_valley = 0.7f / max_ff(SQUARE(wpd->shading.curvature_valley_factor), 1e-4f); | ||||
| /* Will be NULL when rendering. */ | /* Will be NULL when rendering. */ | ||||
| if (draw_ctx->rv3d != NULL) { | if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | ||||
fclem: is that ok during rendering? | |||||
jbakkerAuthorUnsubmitted Done Inline ActionsYes, RV3D_CLIPPING_ENABLED does the NULL checks. jbakker: Yes, `RV3D_CLIPPING_ENABLED` does the NULL checks. | |||||
| RegionView3D *rv3d = draw_ctx->rv3d; | |||||
| if (rv3d->rflag & RV3D_CLIPPING) { | |||||
| wpd->world_clip_planes = rv3d->clip; | wpd->world_clip_planes = rv3d->clip; | ||||
| UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, wpd->world_clip_planes_color); | UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, wpd->world_clip_planes_color); | ||||
| if (wpd->use_color_management) { | if (wpd->use_color_management) { | ||||
| srgb_to_linearrgb_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color); | srgb_to_linearrgb_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color); | ||||
| } | } | ||||
| else { | else { | ||||
| copy_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color); | copy_v3_v3(wpd->world_clip_planes_color, wpd->world_clip_planes_color); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| wpd->world_clip_planes = NULL; | wpd->world_clip_planes = NULL; | ||||
| } | } | ||||
| } | |||||
| workbench_world_data_update_shadow_direction_vs(wpd); | workbench_world_data_update_shadow_direction_vs(wpd); | ||||
| workbench_world_data_ubo_ensure(scene, wpd); | workbench_world_data_ubo_ensure(scene, wpd); | ||||
| /* Cavity settings */ | /* Cavity settings */ | ||||
| { | { | ||||
| const int ssao_samples = scene->display.matcap_ssao_samples; | const int ssao_samples = scene->display.matcap_ssao_samples; | ||||
| ▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines | |||||
is that ok during rendering?