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:
authorBastien Montagne <montagne29@wanadoo.fr>2017-05-17 13:34:06 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2017-05-17 13:34:06 +0300
commit3c799ba8013405142430d7e20c272fe92457852d (patch)
treeca2a9aa891492b522f7ed32ce4a59142ffce7731 /source/blender/draw/intern/draw_common.c
parent11c167ff763528dd0c3a5487f1dc3a49bcabef1a (diff)
DwM: Armature: Add distance outline and wire drawing of envelope bones.
This is not complete, it does not implement 3D solid drawing of envelope bones. 2D wire is hence always drawn for now. Some notes: I did not try to implement the 'capsule' approach suggested by @fclem, because: 1. I spent enough time on this already, and finally got something working. 2. I managed to get rid of geometry shader completely. 3. Current approach allows us to use same shader for distance outline and envelope wire. It's working fine, except for one glitch - superpositions of envelope outlines do not work as expected, not sure what's wrong here, tried to disable zbuff, enable GL_BLEND, no luck so far... I think we need our own 'background' drawpass to get them working (also to avoid them drawing over the wire lines).
Diffstat (limited to 'source/blender/draw/intern/draw_common.c')
-rw-r--r--source/blender/draw/intern/draw_common.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index c266c45e71c..a9b5190a523 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -293,6 +293,22 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Batch *geom)
return grp;
}
+DRWShadingGroup *shgroup_instance_bone_envelope(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+{
+ GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE);
+
+ DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom);
+ DRW_shgroup_attrib_float(grp, "InstanceModelMatrix", 16);
+ DRW_shgroup_attrib_float(grp, "color", 4);
+ DRW_shgroup_attrib_float(grp, "radius_head", 1);
+ DRW_shgroup_attrib_float(grp, "radius_tail", 1);
+ DRW_shgroup_attrib_float(grp, "distance", 1);
+ DRW_shgroup_uniform_mat4(grp, "ObjectModelMatrix", (float *)obmat);
+
+ return grp;
+}
+
+
/* ******************************************** COLOR UTILS *********************************************** */
/* TODO FINISH */
@@ -387,4 +403,4 @@ float *DRW_color_background_blend_get(int theme_id)
UI_GetThemeColorBlendShade4fv(theme_id, TH_BACK, 0.5, 0, ret);
return ret;
-} \ No newline at end of file
+}