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:
authorDalai Felinto <dfelinto@gmail.com>2019-01-11 22:50:45 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-01-12 02:51:15 +0300
commit9f6e09bd8c14ca7ae61f6f1a0b71801e06429d8b (patch)
treea4ea7a8e2240188bac0d0eabe79b5a30e26d1fbc /source/blender/draw/intern/draw_common.c
parent0bd20aa7df2ad7710f92e00d9dc72d826f16762a (diff)
Drawing API: shgroup_instance and shgroup_instance_alpha clarification
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.
Diffstat (limited to 'source/blender/draw/intern/draw_common.c')
-rw-r--r--source/blender/draw/intern/draw_common.c7
1 files changed, 3 insertions, 4 deletions
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;
}