diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-05-16 09:38:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-05-16 09:38:50 +0300 |
commit | 2fa2814c8228d07a5bfc8dc7bb0945217ab29b63 (patch) | |
tree | 021a5a8e650550a7997bd502219dd7ac76ceead4 /source/blender/gpu/intern | |
parent | cbe97bc50f7b31f730b8904b3e8fca83b8532bc1 (diff) |
Fix sculpt drawing with Blender viewport
Would draw without any lighting
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 0191b496685..6281d0a3b67 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1810,6 +1810,8 @@ void GPU_pbvh_buffers_draw( Batch *triangles = do_fast ? buffers->triangles_fast : buffers->triangles; if (triangles) { + + /* Simple Shader: use when drawing without the draw-manager (old 2.7x viewport) */ if (triangles->interface == NULL) { GPUBuiltinShader shader_id = buffers->smooth ? GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR : GPU_SHADER_SIMPLE_LIGHTING_FLAT_COLOR; @@ -1818,6 +1820,15 @@ void GPU_pbvh_buffers_draw( Batch_set_program( triangles, GPU_shader_get_program(shader), GPU_shader_get_interface(shader)); + + static float light[3] = {-0.3f, 0.5f, 1.0f}; + static float alpha = 1.0f; + static float world_light = 1.0f; + + GPU_shader_uniform_vector(shader, GPU_shader_get_uniform(shader, "light"), 3, 1, light); + GPU_shader_uniform_vector(shader, GPU_shader_get_uniform(shader, "alpha"), 1, 1, &alpha); + GPU_shader_uniform_vector(shader, GPU_shader_get_uniform(shader, "global"), 1, 1, &world_light); + } Batch_draw(triangles); } |