Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-05-16 09:38:50 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-05-16 09:38:50 +0300
commit2fa2814c8228d07a5bfc8dc7bb0945217ab29b63 (patch)
tree021a5a8e650550a7997bd502219dd7ac76ceead4 /source/blender/gpu/intern/gpu_buffers.c
parentcbe97bc50f7b31f730b8904b3e8fca83b8532bc1 (diff)
Fix sculpt drawing with Blender viewport
Would draw without any lighting
Diffstat (limited to 'source/blender/gpu/intern/gpu_buffers.c')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c11
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);
}