diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-01-17 16:45:22 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-01-17 16:46:32 +0300 |
commit | 9d3f35a0bf1bf5776363bfd61d53a7c85b5827a4 (patch) | |
tree | 595fe492f09aea9f97049339385f7966ac02f0e1 /source/blender/editors/interface/interface_draw.c | |
parent | edee5a947b7ea3e1324aa334a22c7c9bbf47f5f7 (diff) |
Revert "Revert "GPUShaderCreateInfo for interface abstraction""
This reverts commit edee5a947b7ea3e1324aa334a22c7c9bbf47f5f7.
Fixes compilation error (Missing file BLI_float2.hh)
Diffstat (limited to 'source/blender/editors/interface/interface_draw.c')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 285c82b0fb3..f2fa375aa09 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -57,6 +57,7 @@ #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_matrix.h" +#include "GPU_shader_shared.h" #include "GPU_state.h" #include "UI_interface.h" @@ -1384,10 +1385,16 @@ void ui_draw_but_UNITVEC(uiBut *but, GPU_matrix_scale_1f(size); GPUBatch *sphere = GPU_batch_preset_sphere(2); + struct SimpleLightingData simple_lighting_data; + copy_v4_fl4(simple_lighting_data.color, diffuse[0], diffuse[1], diffuse[2], 1.0f); + copy_v3_v3(simple_lighting_data.light, light); + GPUUniformBuf *ubo = GPU_uniformbuf_create_ex( + sizeof(struct SimpleLightingData), &simple_lighting_data, __func__); + GPU_batch_program_set_builtin(sphere, GPU_SHADER_SIMPLE_LIGHTING); - GPU_batch_uniform_4f(sphere, "color", diffuse[0], diffuse[1], diffuse[2], 1.0f); - GPU_batch_uniform_3fv(sphere, "light", light); + GPU_batch_uniformbuf_bind(sphere, "simple_lighting_data", ubo); GPU_batch_draw(sphere); + GPU_uniformbuf_free(ubo); /* Restore. */ GPU_face_culling(GPU_CULL_NONE); |