Merge branch 'blender2.7'
[blender.git] / source / blender / draw / intern / draw_armature.c
index 417132e6d2f63d691a0417cf47f24db966caecac..a26313a14022b7e8e58a5a3a727377db71a17c63 100644 (file)
@@ -207,11 +207,12 @@ static void drw_shgroup_bone_stick(
 /* Envelope */
 static void drw_shgroup_bone_envelope_distance(
         const float (*bone_mat)[4],
-        const float *radius_head, const float *radius_tail, const float *distance)
+        const float *radius_head, const float *radius_tail, const float *distance,
+        const eGPUShaderConfig sh_cfg)
 {
        if (g_data.passes.bone_envelope != NULL) {
                if (g_data.bone_envelope_distance == NULL) {
-                       g_data.bone_envelope_distance = shgroup_instance_bone_envelope_distance(g_data.passes.bone_envelope);
+                       g_data.bone_envelope_distance = shgroup_instance_bone_envelope_distance(g_data.passes.bone_envelope, sh_cfg);
                        /* passes.bone_envelope should have the DRW_STATE_CULL_FRONT state enabled. */
                }
                float head_sphere[4] = {0.0f, 0.0f, 0.0f, 1.0f}, tail_sphere[4] = {0.0f, 1.0f, 0.0f, 1.0f};
@@ -244,12 +245,12 @@ static void drw_shgroup_bone_envelope(
                g_data.bone_point_solid = shgroup_instance_bone_sphere_solid(g_data.passes.bone_solid, g_data.transparent, sh_cfg);
        }
        if (g_data.bone_envelope_wire == NULL) {
-               g_data.bone_envelope_wire = shgroup_instance_bone_envelope_outline(g_data.passes.bone_wire);
+               g_data.bone_envelope_wire = shgroup_instance_bone_envelope_outline(g_data.passes.bone_wire, sh_cfg);
        }
        if (g_data.bone_envelope_solid == NULL &&
            g_data.passes.bone_solid != NULL)
        {
-               g_data.bone_envelope_solid = shgroup_instance_bone_envelope_solid(g_data.passes.bone_solid, g_data.transparent);
+               g_data.bone_envelope_solid = shgroup_instance_bone_envelope_solid(g_data.passes.bone_solid, g_data.transparent, sh_cfg);
                /* We can have a lot of overdraw if we don't do this. Also envelope are not subject to
                 * inverted matrix. */
                DRW_shgroup_state_enable(g_data.bone_envelope_solid, DRW_STATE_CULL_BACK);
@@ -416,10 +417,12 @@ static void drw_shgroup_bone_point(
 }
 
 /* Axes */
-static void drw_shgroup_bone_axes(const float (*bone_mat)[4], const float color[4])
+static void drw_shgroup_bone_axes(
+        const float (*bone_mat)[4], const float color[4],
+        const eGPUShaderConfig sh_cfg)
 {
        if (g_data.bone_axes == NULL) {
-               g_data.bone_axes = shgroup_instance_bone_axes(g_data.passes.bone_axes);
+               g_data.bone_axes = shgroup_instance_bone_axes(g_data.passes.bone_axes, sh_cfg);
        }
        float final_bonemat[4][4];
        mul_m4_m4m4(final_bonemat, g_data.ob->obmat, bone_mat);
@@ -1171,7 +1174,9 @@ static void draw_bone_update_disp_matrix_custom(bPoseChannel *pchan)
        translate_m4(disp_tail_mat, 0.0f, 1.0f, 0.0f);
 }
 
-static void draw_axes(EditBone *eBone, bPoseChannel *pchan)
+static void draw_axes(
+        EditBone *eBone, bPoseChannel *pchan,
+        const eGPUShaderConfig sh_cfg)
 {
        float final_col[4];
        const float *col = (g_theme.const_color) ? g_theme.const_color :
@@ -1179,7 +1184,7 @@ static void draw_axes(EditBone *eBone, bPoseChannel *pchan)
        copy_v4_v4(final_col, col);
        /* Mix with axes color. */
        final_col[3] = (g_theme.const_color) ? 1.0 : (BONE_FLAG(eBone, pchan) & BONE_SELECTED) ? 0.3 : 0.8;
-       drw_shgroup_bone_axes(BONE_VAR(eBone, pchan, disp_mat), final_col);
+       drw_shgroup_bone_axes(BONE_VAR(eBone, pchan, disp_mat), final_col, sh_cfg);
 }
 
 static void draw_points(
@@ -1332,7 +1337,7 @@ static void draw_bone_envelope(
            (boneflag & BONE_NO_DEFORM) == 0 &&
            ((boneflag & BONE_SELECTED) || (eBone && (boneflag & (BONE_ROOTSEL | BONE_TIPSEL)))))
        {
-               drw_shgroup_bone_envelope_distance(BONE_VAR(eBone, pchan, disp_mat), rad_head, rad_tail, distance);
+               drw_shgroup_bone_envelope_distance(BONE_VAR(eBone, pchan, disp_mat), rad_head, rad_tail, distance, sh_cfg);
        }
 
        if (select_id != -1) {
@@ -1782,7 +1787,7 @@ static void draw_armature_edit(Object *ob)
 
                                /*      Draw additional axes */
                                if (arm->flag & ARM_DRAWAXES) {
-                                       draw_axes(eBone, NULL);
+                                       draw_axes(eBone, NULL, draw_ctx->sh_cfg);
                                }
                        }
                }
@@ -1906,7 +1911,7 @@ static void draw_armature_pose(Object *ob, const float const_color[4])
 
                                /*      Draw additional axes */
                                if (arm->flag & ARM_DRAWAXES) {
-                                       draw_axes(NULL, pchan);
+                                       draw_axes(NULL, pchan, draw_ctx->sh_cfg);
                                }
                        }
                }