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:
authorClément Foucault <foucault.clem@gmail.com>2018-05-06 19:36:27 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-05-06 19:42:23 +0300
commitc769b1a5533bb0fcf04452cde4d81dd77f7ae03b (patch)
treef80d6bb3a8a9ab41f07e3f71e2a0eb2ab62d17e3 /source/blender/draw/modes/pose_mode.c
parent48ddb2b98a5d9f77d5589afd137019dc85f1e460 (diff)
Armature: Add a special Pass for bone axes.
In object mode, the axes are drawn like any other wire objects with depth test and depth write. Thus enabling MSAA to work but not their xray behaviour. In edit armature/pose mode, draw smooth line without depth testing. This produces wrong draw ordering problem but still gives the desired xray behaviour. We do it outside of the MSAA pass since the xray behaviour is not compatible with it. But we are drawing smoothed lines so no need for MSAA. The lines are 2px thick and improve readability.
Diffstat (limited to 'source/blender/draw/modes/pose_mode.c')
-rw-r--r--source/blender/draw/modes/pose_mode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/draw/modes/pose_mode.c b/source/blender/draw/modes/pose_mode.c
index d1b4dd77246..10d6bffcbe1 100644
--- a/source/blender/draw/modes/pose_mode.c
+++ b/source/blender/draw/modes/pose_mode.c
@@ -47,6 +47,7 @@ typedef struct POSE_PassList {
struct DRWPass *bone_outline;
struct DRWPass *bone_wire;
struct DRWPass *bone_envelope;
+ struct DRWPass *bone_axes;
struct DRWPass *relationship;
} POSE_PassList;
@@ -107,6 +108,11 @@ static void POSE_cache_init(void *vedata)
}
{
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WIRE_SMOOTH | DRW_STATE_BLEND;
+ psl->bone_axes = DRW_pass_create("Bone Axes Pass", state);
+ }
+
+ {
/* Non Meshes Pass (Camera, empties, lamps ...) */
DRWState state =
DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS |
@@ -136,6 +142,7 @@ static void POSE_cache_populate(void *vedata, Object *ob)
.bone_outline = psl->bone_outline,
.bone_wire = psl->bone_wire,
.bone_envelope = psl->bone_envelope,
+ .bone_axes = psl->bone_axes,
};
DRW_shgroup_armature_pose(ob, passes, stl->g_data->relationship_lines);
}
@@ -183,6 +190,9 @@ static void POSE_draw_scene(void *vedata)
DRW_draw_pass(psl->relationship);
MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl)
+
+ /* Draw axes with linesmooth and outside of multisample buffer. */
+ DRW_draw_pass(psl->bone_axes);
}
/* Create collection settings here.