diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-11-29 22:57:09 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-11-29 23:52:36 +0300 |
commit | 48a7785fd453603afcbcae31913ea528469fd934 (patch) | |
tree | fa7e6c31b7e95684936360131dee8ee342e4afb7 /source/blender/draw | |
parent | 844788a36cb0e1efdf3a2010ee67abcb7c46474c (diff) |
Workbench: Add option to have world space lighting in studio light mode
This option is per viewport.
Having view space shading make sense when working on isolated objects like
if you were holding them in your hands. But for entire scene work, it is
better to have the lighting fixed to have a better spatial representation.
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_private.h | 1 | ||||
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_studiolight.c | 3 |
2 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index b1f3a589d05..9853737518c 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -46,6 +46,7 @@ #define FLAT_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_FLAT) #define STUDIOLIGHT_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_STUDIO) #define MATCAP_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_MATCAP) +#define USE_WORLD_ORIENTATION(wpd) ((wpd->shading.flag & V3D_SHADING_WORLD_ORIENTATION) != 0) #define STUDIOLIGHT_TYPE_WORLD_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_WORLD)) #define STUDIOLIGHT_TYPE_STUDIO_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_STUDIO)) #define STUDIOLIGHT_TYPE_MATCAP_ENABLED(wpd) (MATCAP_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_TYPE_MATCAP)) diff --git a/source/blender/draw/engines/workbench/workbench_studiolight.c b/source/blender/draw/engines/workbench/workbench_studiolight.c index 183b285c69c..f0a166105ab 100644 --- a/source/blender/draw/engines/workbench/workbench_studiolight.c +++ b/source/blender/draw/engines/workbench/workbench_studiolight.c @@ -37,8 +37,7 @@ void studiolight_update_world(WORKBENCH_PrivateData *wpd, StudioLight *studiolig float view_matrix[4][4], rot_matrix[4][4]; DRW_viewport_matrix_get(view_matrix, DRW_MAT_VIEW); - /* TODO enable when we support studiolight presets. */ - if (STUDIOLIGHT_TYPE_WORLD_ENABLED(wpd) && false) { + if (USE_WORLD_ORIENTATION(wpd)) { axis_angle_to_mat4_single(rot_matrix, 'Y', -wpd->shading.studiolight_rot_z); mul_m4_m4m4(rot_matrix, rot_matrix, view_matrix); swap_v3_v3(rot_matrix[2], rot_matrix[1]); |