From 9f6e09bd8c14ca7ae61f6f1a0b71801e06429d8b Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 11 Jan 2019 17:50:45 -0200 Subject: Drawing API: shgroup_instance and shgroup_instance_alpha clarification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit shgroup_instance_alpha was getting a color[4] but would only use the alpha defined upon creation of the shading group. This was very limiting since it wouldn't allow for different instances to have different alpha values. Patch made with Clément Foucault (he made the code of it, while I fixed all the parts of the code that were relying on shgroup_instance_alpha. --- source/blender/draw/intern/draw_common.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source/blender/draw/intern/draw_common.c') diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index 9b969c23ba6..15a8675f55d 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -444,18 +444,18 @@ DRWShadingGroup *shgroup_instance(DRWPass *pass, struct GPUBatch *geom) GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE); DRW_shgroup_instance_format(g_formats.instance_sized, { - {"color", DRW_ATTRIB_FLOAT, 3}, + {"color", DRW_ATTRIB_FLOAT, 4}, {"size", DRW_ATTRIB_FLOAT, 1}, {"InstanceModelMatrix", DRW_ATTRIB_FLOAT, 16} }); DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized); - DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + DRW_shgroup_state_disable(grp, DRW_STATE_BLEND); return grp; } -DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, float alpha) +DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom) { GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE); @@ -466,7 +466,6 @@ DRWShadingGroup *shgroup_instance_alpha(DRWPass *pass, struct GPUBatch *geom, fl }); DRWShadingGroup *grp = DRW_shgroup_instance_create(sh_inst, pass, geom, g_formats.instance_sized); - DRW_shgroup_uniform_float_copy(grp, "alpha", alpha); return grp; } -- cgit v1.2.3