diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-05-18 13:10:10 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-05-18 13:13:19 +0300 |
commit | 5dd9e172669e3cd0e018091fd37eb091daf0d6ee (patch) | |
tree | 85d30d57553946b00ade255f5ccbc6caeb5bd60a /source/blender/draw | |
parent | 23f256b24bed34bb25d1d66ec9ba0726f7a71659 (diff) |
DwM: Armature: Cleanup envelope bone code a bit.
Mainly adding 'wire' suffix to wire/distance drawing func and shader.
Also, match wire vertex shader behavior with solid one regarding
head/tail only drawing (i.e. alwas expect head bone mat, never tail one,
and assume that if a radius is negative, then we only draw on the other
end of the bone).
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_armature.c | 24 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.h | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_common.c | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_common.h | 2 |
5 files changed, 13 insertions, 21 deletions
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index c4be82a223b..7e12ac7d3f8 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -159,7 +159,7 @@ static void DRW_shgroup_bone_envelope_distance( if (g_data.bone_envelope_distance == NULL) { struct Batch *geom = DRW_cache_bone_envelope_distance_outline_get(); /* Note: bone_wire draw pass is not really working, think we need another one here? */ - g_data.bone_envelope_distance = shgroup_instance_bone_envelope(g_data.pass_bone_envelope, geom, g_data.ob->obmat); + g_data.bone_envelope_distance = shgroup_instance_bone_envelope_wire(g_data.pass_bone_envelope, geom, g_data.ob->obmat); } DRW_shgroup_call_dynamic_add(g_data.bone_envelope_distance, bone_mat, color, radius_head, radius_tail, distance); @@ -171,7 +171,7 @@ static void DRW_shgroup_bone_envelope_solid( const float *radius_head, const float *radius_tail) { if (g_data.bone_envelope_solid == NULL) { - struct Batch *geom = DRW_cache_bone_envelope_get(); + struct Batch *geom = DRW_cache_bone_envelope_solid_get(); g_data.bone_envelope_solid = shgroup_instance_bone_envelope_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat); } @@ -184,7 +184,7 @@ static void DRW_shgroup_bone_envelope_wire( { if (g_data.bone_envelope_wire == NULL) { struct Batch *geom = DRW_cache_bone_envelope_wire_outline_get(); - g_data.bone_envelope_wire = shgroup_instance_bone_envelope(g_data.pass_bone_wire, geom, g_data.ob->obmat); + g_data.bone_envelope_wire = shgroup_instance_bone_envelope_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat); } DRW_shgroup_call_dynamic_add(g_data.bone_envelope_wire, bone_mat, color, radius_head, radius_tail, distance); @@ -196,7 +196,7 @@ static void DRW_shgroup_bone_envelope_head_wire( { if (g_data.bone_envelope_head_wire == NULL) { struct Batch *geom = DRW_cache_bone_envelope_head_wire_outline_get(); - g_data.bone_envelope_head_wire = shgroup_instance_bone_envelope(g_data.pass_bone_wire, geom, g_data.ob->obmat); + g_data.bone_envelope_head_wire = shgroup_instance_bone_envelope_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat); } DRW_shgroup_call_dynamic_add(g_data.bone_envelope_head_wire, bone_mat, color, radius_head, radius_tail, distance); @@ -974,7 +974,7 @@ static void draw_points( DRW_shgroup_bone_envelope_solid(eBone->disp_mat, col_solid_root, &eBone->rad_head, &envelope_ignore); DRW_shgroup_bone_envelope_head_wire(eBone->disp_mat, col_wire_root, - &eBone->rad_head, &eBone->rad_tail, &eBone->dist); + &eBone->rad_head, &envelope_ignore, &envelope_ignore); } else { DRW_shgroup_bone_point_solid(eBone->disp_mat, col_solid_root); @@ -989,7 +989,7 @@ static void draw_points( DRW_shgroup_bone_envelope_solid(pchan->disp_mat, col_solid_root, &bone->rad_head, &envelope_ignore); DRW_shgroup_bone_envelope_head_wire(pchan->disp_mat, col_wire_root, - &bone->rad_head, &bone->rad_tail, &bone->dist); + &bone->rad_head, &envelope_ignore, &envelope_ignore); } else { DRW_shgroup_bone_point_solid(pchan->disp_mat, col_solid_root); @@ -1005,19 +1005,11 @@ static void draw_points( } if (is_envelope_draw) { - const float *rad_tail, *dist; - if (eBone) { - rad_tail = &eBone->rad_tail; - dist = &eBone->dist; - } - else { - rad_tail = &pchan->bone->rad_tail; - dist = &pchan->bone->dist; - } + const float *rad_tail = eBone ? &eBone->rad_tail : &pchan->bone->rad_tail; DRW_shgroup_bone_envelope_solid( BONE_VAR(eBone, pchan, disp_mat), col_solid_tail, &envelope_ignore, rad_tail); DRW_shgroup_bone_envelope_head_wire( - BONE_VAR(eBone, pchan, disp_tail_mat), col_wire_tail, rad_tail, rad_tail, dist); + BONE_VAR(eBone, pchan, disp_mat), col_wire_tail, &envelope_ignore, rad_tail, &envelope_ignore); } else { DRW_shgroup_bone_point_solid(BONE_VAR(eBone, pchan, disp_tail_mat), col_solid_tail); diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 18e64a86fa9..79b4d391fa4 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -1560,7 +1560,7 @@ static void benv_add_tri(VertexBuffer *vbo, uint pos_id, uint *v_idx, float *co1 } } -Batch *DRW_cache_bone_envelope_get(void) +Batch *DRW_cache_bone_envelope_solid_get(void) { #define CIRCLE_RESOL 32 /* Must be multiple of 4 */ if (!SHC.drw_bone_envelope) { diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index b0fc5cf93a8..b6805cd6477 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -82,7 +82,7 @@ struct Batch *DRW_cache_bone_octahedral_wire_outline_get(void); struct Batch *DRW_cache_bone_box_get(void); struct Batch *DRW_cache_bone_box_wire_outline_get(void); struct Batch *DRW_cache_bone_wire_wire_outline_get(void); -struct Batch *DRW_cache_bone_envelope_get(void); +struct Batch *DRW_cache_bone_envelope_solid_get(void); struct Batch *DRW_cache_bone_envelope_distance_outline_get(void); struct Batch *DRW_cache_bone_envelope_wire_outline_get(void); struct Batch *DRW_cache_bone_envelope_head_wire_outline_get(void); diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index d99b20d5ff3..6d6df8dc6f4 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -293,9 +293,9 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Batch *geom) return grp; } -DRWShadingGroup *shgroup_instance_bone_envelope(DRWPass *pass, struct Batch *geom, float (*obmat)[4]) +DRWShadingGroup *shgroup_instance_bone_envelope_wire(DRWPass *pass, struct Batch *geom, float (*obmat)[4]) { - GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE); + GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_WIRE); DRWShadingGroup *grp = DRW_shgroup_instance_create(sh, pass, geom); DRW_shgroup_attrib_float(grp, "InstanceModelMatrix", 16); diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h index 49010aac087..04c64357cf3 100644 --- a/source/blender/draw/intern/draw_common.h +++ b/source/blender/draw/intern/draw_common.h @@ -101,7 +101,7 @@ struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct Batch *geo struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct Batch *geom); struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct Batch *geom); struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct Batch *geom); -struct DRWShadingGroup *shgroup_instance_bone_envelope(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]); +struct DRWShadingGroup *shgroup_instance_bone_envelope_wire(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]); struct DRWShadingGroup *shgroup_instance_bone_envelope_solid(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]); int DRW_object_wire_theme_get(struct Object *ob, struct SceneLayer *sl, float **r_color); |